File Coverage

blib/lib/Crypt/Passphrase/Fallback.pm
Criterion Covered Total %
statement 9 16 56.2
branch n/a
condition 0 3 0.0
subroutine 3 7 42.8
pod 2 3 66.6
total 14 29 48.2


line stmt bran cond sub pod time code
1             package Crypt::Passphrase::Fallback;
2             $Crypt::Passphrase::Fallback::VERSION = '0.021';
3 1     1   138799 use strict;
  1         2  
  1         49  
4 1     1   7 use warnings;
  1         2  
  1         102  
5              
6 1     1   7 use parent 'Crypt::Passphrase::Validator';
  1         2  
  1         9  
7              
8             sub new {
9 0     0 0   my ($class, %args) = @_;
10             return bless {
11             callback => $args{callback},
12 0     0     acceptor => $args{acceptor} // sub { 1 },
13 0   0       }, $class;
14             }
15              
16             sub accepts_hash {
17 0     0 1   my ($self, $hash) = @_;
18 0           return $self->{acceptor}->($hash);
19             }
20              
21             sub verify_password {
22 0     0 1   my ($self, $password, $hash) = @_;
23 0           return $self->{callback}->($password, $hash);
24             }
25              
26             1;
27              
28             #ABSTRACT: a fallback validator for Crypt::Passphrase
29              
30             __END__