Policy/Rule/Length.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 90.9% 40 / 44 CC 4 SCAR 7.9
CC
4
Cov
94%
check
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« Policy.pm ↑ Summary Policy/Exception.pm »
1 package Password::Policy::Rule::Length;
2 4 $Password::Policy::Rule::Length::VERSION = '0.06';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use parent 'Password::Policy::Rule';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use String::Multibyte;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Password::Policy::Exception::InsufficientLength;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶sub default_arg { return 8; }
Subroutine default_arg: called CC=1 SCAR=0.0
Pod undocumented
13  
14 20 ▶sub check {
Subroutine check: called CC=4 SCAR=13.9
Pod undocumented
15 20 my $self = shift;
16 20 my $password = $self->prepare(shift);
17 19 my $strmb = String::Multibyte->new('UTF8');
18 19 ▶ if($strmb->islegal($password)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strmb->islegal($password)) { } 18 1 19
19 18 my $len = $strmb->length($password);
20 18 ▶ if($len < $self->arg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len < $self->arg) 4 14 18
21 4 Password::Policy::Exception::InsufficientLength->throw;
22 }
23 } else {
24 1 my $len = length $password;
25 1 ▶ if($len < $self->arg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len < $self->arg) 0 1 1
26 0 Password::Policy::Exception::InsufficientLength->throw;
27 }
28 }
29 15 return 1;
30 }
31  
32 4 1;
33  
34 __END__
« Policy.pm ↑ Summary Policy/Exception.pm »