File Coverage

blib/lib/Password/Policy/Rule/Uppercase.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::Uppercase;
2             {
3             $Password::Policy::Rule::Uppercase::VERSION = '0.02';
4             }
5              
6 1     1   46201 use strict;
  1         2  
  1         33  
7 1     1   6 use warnings;
  1         2  
  1         28  
8              
9 1     1   857 use parent 'Password::Policy::Rule';
  1         311  
  1         5  
10              
11 1     1   1211 use String::Multibyte;
  1         11378  
  1         58  
12              
13 1     1   647 use Password::Policy::Exception::InsufficientUppercase;
  1         3  
  1         153  
14              
15             sub check {
16 7     7 0 203 my $self = shift;
17 7         29 my $password = $self->prepare(shift);
18 6         39 my @uppercase = ($password =~ m/[A-Z]/g);
19 6         11 my $count = scalar @uppercase;
20 6 100       19 if($count < $self->arg) {
21 3         21 Password::Policy::Exception::InsufficientUppercase->throw;
22             }
23 3         17 return 1;
24             }
25              
26             1;
27              
28              
29              
30             =pod
31              
32             =head1 NAME
33              
34             Password::Policy::Rule::Uppercase
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__