File Coverage

blib/lib/Crypt/Passphrase/Validator.pm
Criterion Covered Total %
statement 11 11 100.0
branch 2 4 50.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 17 19 89.4


line stmt bran cond sub pod time code
1             package Crypt::Passphrase::Validator;
2             $Crypt::Passphrase::Validator::VERSION = '0.021';
3 13     13   203550 use strict;
  13         31  
  13         503  
4 13     13   70 use warnings;
  13         23  
  13         2759  
5              
6             our @CARP_NOT = 'Crypt::Passphrase';
7              
8             sub secure_compare {
9 20     20 1 128 my ($self, $left, $right) = @_;
10 20 50       100 return if length $left != length $right;
11 20         50 my $r = 0;
12 20         749 $r |= ord(substr $left, $_, 1) ^ ord(substr $right, $_, 1) for 0 .. length($left) - 1;
13 20 50       327 return $r == 0 ? 1 : undef;
14             }
15              
16             1;
17              
18             #ABSTRACT: Base class for Crypt::Passphrase validators
19              
20             __END__