| 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
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 32 | 1 | ▶ | warn "Passwords don't match\n" if ($args{passwd} ne $initial_pw); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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; | |||||||||||||||||||