File Coverage

blib/lib/Password/Policy/Rule/Whitespace.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::Whitespace;
2             $Password::Policy::Rule::Whitespace::VERSION = '0.03';
3 1     1   23255 use strict;
  1         2  
  1         28  
4 1     1   4 use warnings;
  1         1  
  1         21  
5              
6 1     1   395 use parent 'Password::Policy::Rule';
  1         230  
  1         4  
7              
8 1     1   354 use Password::Policy::Exception::InsufficientWhitespace;
  1         2  
  1         85  
9              
10             sub check {
11 6     6 0 123 my $self = shift;
12 6         19 my $password = $self->prepare(shift);
13 5         23 my @whitespace = ($password =~ m/\s/g);
14 5         7 my $count = scalar @whitespace;
15 5 100       13 if($count < $self->arg) {
16 2         11 Password::Policy::Exception::InsufficientWhitespace->throw;
17             }
18 3         10 return 1;
19             }
20              
21             1;
22              
23             __END__