File Coverage

blib/lib/Password/Policy/Rule/Whitespace.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::Whitespace;
2             {
3             $Password::Policy::Rule::Whitespace::VERSION = '0.02';
4             }
5              
6 1     1   30100 use strict;
  1         3  
  1         38  
7 1     1   6 use warnings;
  1         2  
  1         29  
8              
9 1     1   969 use parent 'Password::Policy::Rule';
  1         366  
  1         6  
10              
11 1     1   1169 use String::Multibyte;
  1         5737  
  1         68  
12              
13 1     1   709 use Password::Policy::Exception::InsufficientWhitespace;
  1         3  
  1         127  
14              
15             sub check {
16 6     6 0 356 my $self = shift;
17 6         25 my $password = $self->prepare(shift);
18 5         35 my @whitespace = ($password =~ m/\s/g);
19 5         7 my $count = scalar @whitespace;
20 5 100       16 if($count < $self->arg) {
21 2         18 Password::Policy::Exception::InsufficientWhitespace->throw;
22             }
23 3         15 return 1;
24             }
25              
26             1;
27              
28              
29              
30             =pod
31              
32             =head1 NAME
33              
34             Password::Policy::Rule::Whitespace
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__