Tested/Value/PasswordBox.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 2 / 2 Conditioncond 100% 4 / 4 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 100% 35 / 35 CC 4 SCAR 6.4
CC
4
Cov
100%
__ANON__
3.0
new
2.0
BEGIN
1.0
CRAP 1.9
« Tested/Value/DropDown.pm ↑ Summary Tested/List/Renderer.pm »
1 =head1 NAME
2  
3 HTML::Tested::Value::PasswordBox - password input.
4  
5 =head1 DESCRIPTION
6  
7 Provides <input type="password" /> html tag.
8  
9 =head1 METHODS
10  
11 =cut
12  
13 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 package HTML::Tested::Value::PasswordBox;
17 1 ▶use base 'HTML::Tested::Value';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 =head2 $class->new($parent, $name, %opts)
20  
21 Overloads C<HTML::Tested::Value> C<new> function to handle C<check_mismatch>
22 option.
23  
24 =cut
25 5 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
26 5 my ($class, $parent, $name, %opts) = @_;
27 5 my $other = $opts{check_mismatch};
28 1 ▶ push @{ $opts{constraints} }, [ mismatch => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
29 4 my ($v, $root) = @_;
30 4 ▶ return ($v // '') eq ($root->$other // '');
Condition100%4/4
$v // ""
l!l
31
$root->$other // ""
l!l
22
MC/DC100%1/1
$v // ""
$v
MC/DC100%1/1
$root->$other // ""
$root->$other
Truth table100%2/2
A
A= $v
Aresult
11
00
Truth table100%2/2
A
A= $root->$other
Aresult
11
00
31 5 ▶ } ] if $other;
Branch: 1 branch
BranchTrueFalseTotal
if $other 1 4 5
32 5 return $class->SUPER::new($parent, $name, %opts);
33 }
34  
35 1 ▶sub value_to_string {
Subroutine value_to_string: called CC=1 SCAR=0.0
Pod documented
36 1 my ($self, $name, $val) = @_;
37 1 return <<ENDS;
38 <input type="password" name="$name" id="$name" value="$val" />
39 ENDS
40 }
41  
42 1 1;
43  
44 =head1 OPTIONS
45  
46 =over
47  
48 =item check_mismatch
49  
50 Checks mismatch between two passwords during validate phase. The parameter
51 should be the name of another password box.
52  
53 E.g. check_mismatch => 'another_password'.
54  
55 On failure produces C<mismatch> result for validate function.
56  
57 =back
58  
59 =head1 AUTHOR
60  
61 Boris Sukholitko (boriss@gmail.com)
62
63 =head1 COPYRIGHT
64  
65 This program is free software; you can redistribute
66 it and/or modify it under the same terms as Perl itself.
67  
68 The full text of the license can be found in the
69 LICENSE file included with this module.
70  
71 =cut
« Tested/Value/DropDown.pm ↑ Summary Tested/List/Renderer.pm »