File Coverage

blib/lib/App/Tel/Passwd/Mock.pm
Criterion Covered Total %
statement 6 11 54.5
branch 0 2 0.0
condition 0 3 0.0
subroutine 2 4 50.0
pod 2 2 100.0
total 10 22 45.4


line stmt bran cond sub pod time code
1             package App::Tel::Passwd::Mock;
2              
3             =head1 name
4              
5             App::Tel::Passwd::Mock - Passwd module for testing password modules.
6              
7             =cut
8              
9 1     1   431 use strict;
  1         1  
  1         22  
10 1     1   3 use warnings;
  1         1  
  1         113  
11              
12             our $_debug = 0;
13             our $mock_pass = 'mock password'; # this is the password we return from passwd()
14             our $initial_pw = 'initialization password'; # this is the password to "unlock the file"
15              
16             =head1 METHODS
17              
18             =head2 new
19              
20             my $passwd = App::Tel::Passwd::Mock->new( file => $filename, passwd => $password );
21              
22             Initializes a new passwd object. This will return a Passwd::Mock Object if the module
23             exists and return undef if it doesn't.
24              
25             Requires filename and password for the file.
26              
27             =cut
28              
29             sub new {
30 0     0 1   my ($proto,%args) = @_;
31 0   0       my $class = ref($proto) || $proto;
32 0 0         warn "Passwords don't match\n" if ($args{passwd} ne $initial_pw);
33 0           return bless( {}, $class );
34             }
35              
36             =head2 passwd
37              
38             $passwd->passwd($entry);
39              
40             This takes the entry for a key database and returns the password. It returns
41             a blank string if the entry wasn't found.
42              
43             =cut
44              
45             sub passwd {
46 0     0 1   return $mock_pass;
47             }
48              
49             1;