File Coverage

blib/lib/Password/Policy/Rule/Numbers.pm
Criterion Covered Total %
statement 22 22 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Password::Policy::Rule::Numbers;
2             {
3             $Password::Policy::Rule::Numbers::VERSION = '0.02';
4             }
5              
6 1     1   52946 use strict;
  1         2  
  1         37  
7 1     1   6 use warnings;
  1         2  
  1         31  
8              
9 1     1   13284 use parent 'Password::Policy::Rule';
  1         409  
  1         7  
10              
11 1     1   1110 use String::Multibyte;
  1         5579  
  1         65  
12              
13 1     1   693 use Password::Policy::Exception::InsufficientNumbers;
  1         2  
  1         131  
14              
15             sub check {
16 6     6 0 184 my $self = shift;
17 6         27 my $password = $self->prepare(shift);
18 5         37 my @numbers = ($password =~ m/(\d)/g);
19 5         10 my $count = scalar @numbers;
20 5 100       19 if($count < $self->arg) {
21 2         18 Password::Policy::Exception::InsufficientNumbers->throw;
22             }
23 3         16 return 1;
24             }
25              
26             1;
27              
28              
29              
30             =pod
31              
32             =head1 NAME
33              
34             Password::Policy::Rule::Numbers
35              
36             =head1 VERSION
37              
38             version 0.02
39              
40             =head1 AUTHOR
41              
42             Andrew Nelson
43              
44             =head1 COPYRIGHT AND LICENSE
45              
46             This software is copyright (c) 2012 by Andrew Nelson.
47              
48             This is free software; you can redistribute it and/or modify it under
49             the same terms as the Perl 5 programming language system itself.
50              
51             =cut
52              
53              
54             __END__