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             {
3             $Password::Policy::Rule::Length::VERSION = '0.02';
4             }
5              
6 1     1   32372 use strict;
  1         2  
  1         27  
7 1     1   15 use warnings;
  1         2  
  1         34  
8              
9 1     1   757 use parent 'Password::Policy::Rule';
  1         304  
  1         6  
10              
11 1     1   1047 use String::Multibyte;
  1         5167  
  1         52  
12              
13 1     1   615 use Password::Policy::Exception::InsufficientLength;
  1         2  
  1         134  
14              
15 2     2 0 18 sub default_arg { return 8; }
16              
17             sub check {
18 6     6 0 223 my $self = shift;
19 6         29 my $password = $self->prepare(shift);
20 5         28 my $strmb = String::Multibyte->new('UTF8');
21 5         5275 my $len = $strmb->length($password);
22 5 100       125 if($len < $self->arg) {
23 3         25 Password::Policy::Exception::InsufficientLength->throw;
24             }
25 2         34 return 1;
26             }
27              
28             1;
29              
30              
31              
32             =pod
33              
34             =head1 NAME
35              
36             Password::Policy::Rule::Length
37              
38             =head1 VERSION
39              
40             version 0.02
41              
42             =head1 AUTHOR
43              
44             Andrew Nelson
45              
46             =head1 COPYRIGHT AND LICENSE
47              
48             This software is copyright (c) 2012 by Andrew Nelson.
49              
50             This is free software; you can redistribute it and/or modify it under
51             the same terms as the Perl 5 programming language system itself.
52              
53             =cut
54              
55              
56             __END__