File Coverage

blib/lib/Password/Policy/Rule/Numbers.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package Password::Policy::Rule::Numbers;
2             $Password::Policy::Rule::Numbers::VERSION = '0.03';
3 2     2   20841 use strict;
  2         4  
  2         67  
4 2     2   7 use warnings;
  2         2  
  2         50  
5              
6 2     2   513 use parent 'Password::Policy::Rule';
  2         278  
  2         11  
7              
8 2     2   878 use Password::Policy::Exception::InsufficientNumbers;
  2         5  
  2         224  
9              
10             sub check {
11 9     9 0 126 my $self = shift;
12 9         27 my $password = $self->prepare(shift);
13 8         40 my @numbers = ($password =~ m/(\d)/g);
14 8         9 my $count = scalar @numbers;
15 8 100       20 if($count < $self->arg) {
16 3         21 Password::Policy::Exception::InsufficientNumbers->throw;
17             }
18 5         17 return 1;
19             }
20              
21             1;
22              
23             __END__