blib/lib/App/Tel/Passwd/Mock.pm

filter: Statementstmt 100% 15 / 15 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 82.1% 23 / 28 CC 3 SCAR 7.7
CC
3
Cov
85%
new
3.3
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« lib/App/Tel/Color/CiscoPingRainbow.pm ↑ Summary lib/App/Tel/Macro.pm »
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 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $_debug = 0;
13 1 our $mock_pass = 'mock password'; # this is the password we return from passwd()
14 1 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 1 ▶sub new {
Subroutine new: called CC=3 SCAR=12.0
Pod documented
30 1 my ($proto,%args) = @_;
31 1 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
32 1 ▶ warn "Passwords don't match\n" if ($args{passwd} ne $initial_pw);
Branch: 1 branch
BranchTrueFalseTotal
if $args{"passwd"} ne $App::Tel::Passwd::Mock::initial_pw 0 1 1
33 1 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 1 ▶sub passwd {
Subroutine passwd: called CC=1 SCAR=0.0
Pod documented
46 1 return $mock_pass;
47 }
48  
49 1 1;
« lib/App/Tel/Color/CiscoPingRainbow.pm ↑ Summary lib/App/Tel/Macro.pm »