File Coverage

blib/lib/Password/Policy/Rule/Length.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 32 34 94.1


line stmt bran cond sub pod time code
1             package Password::Policy::Rule::Length;
2             $Password::Policy::Rule::Length::VERSION = '0.03';
3 3     3   21411 use strict;
  3         5  
  3         101  
4 3     3   10 use warnings;
  3         4  
  3         74  
5              
6 3     3   414 use parent 'Password::Policy::Rule';
  3         271  
  3         15  
7              
8 3     3   1738 use String::Multibyte;
  3         10940  
  3         141  
9              
10 3     3   1393 use Password::Policy::Exception::InsufficientLength;
  3         6  
  3         270  
11              
12 2     2 0 13 sub default_arg { return 8; }
13              
14             sub check {
15 18     18 0 172 my $self = shift;
16 18         53 my $password = $self->prepare(shift);
17 17         61 my $strmb = String::Multibyte->new('UTF8');
18 17         10649 my $len = $strmb->length($password);
19 17 100       372 if($len < $self->arg) {
20 4         25 Password::Policy::Exception::InsufficientLength->throw;
21             }
22 13         157 return 1;
23             }
24              
25             1;
26              
27             __END__