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.06';
3 1     1   107446 use strict;
  1         2  
  1         31  
4 1     1   4 use warnings;
  1         5  
  1         42  
5              
6 1     1   444 use parent 'Password::Policy::Rule';
  1         280  
  1         4  
7              
8 1     1   528 use Password::Policy::Exception::InsufficientWhitespace;
  1         2  
  1         119  
9              
10             sub check {
11 6     6 0 174 my $self = shift;
12 6         19 my $password = $self->prepare(shift);
13 5         28 my @whitespace = ($password =~ m/\s/g);
14 5         6 my $count = scalar @whitespace;
15 5 100       11 if($count < $self->arg) {
16 2         12 Password::Policy::Exception::InsufficientWhitespace->throw;
17             }
18 3         12 return 1;
19             }
20              
21             1;
22              
23             __END__