lib/Data/Validation/Constraints/Password.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 6 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 33 / 33 CC 5 SCAR 12.5
CC
5
Cov
100%
validate
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« lib/Data/Validation/Constraints.pm ↑ Summary blib/lib/Data/Validation/Constraints/Date.pm »
1 package Data::Validation::Constraints::Password;
2  
3 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Data::Validation::Constants qw( EXCEPTION_CLASS FALSE TRUE );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 extends q(Data::Validation::Constraints);
9  
10 1 EXCEPTION_CLASS->add_exception( 'ValidPassword', {
11 parents => [ 'InvalidParameter' ],
12 error => 'Parameter [_1] is not a valid password',
13 explain => 'Must be longer than {min_length} characters long, contain '
14 . 'non alpha characters and must not be wholely numeric' } );
15  
16 10 ▶sub validate {
Subroutine validate: called CC=5 SCAR=16.1
Pod documented
17 10 ▶ my ($self, $val) = @_; my $min_length = $self->min_length || 6;
Condition100%2/2
$self->min_length || 6
l!l
28
MC/DC100%1/1
$self->min_length || 6
$self->min_length
Truth table100%2/2
A
A= $self->min_length
Aresult
11
00
18  
19 10 ▶ length $val < $min_length and return FALSE;
Branch: 1 branch
BranchTrueFalseTotal
length $val < $min_length and return 0 2 8 10
20 8 ▶ $val =~ m{ \A \d+ \z }mx and return FALSE;
Branch: 1 branch
BranchTrueFalseTotal
$val =~ / \A \d+ \z /mx and return 0 1 7 8
21 7 $val =~ tr{A-Z}{a-z}; $val =~ tr{a-z}{}d;
22 7 ▶ return length $val > 0 ? TRUE : FALSE;
Branch: 1 branch
BranchTrueFalseTotal
length $val > 0 ? : 5 2 7
23 }
24  
25 1 1;
26  
27 # Local Variables:
28 # mode: perl
29 # tab-width: 3
30 # End:
« lib/Data/Validation/Constraints.pm ↑ Summary blib/lib/Data/Validation/Constraints/Date.pm »