Simple.pm

filter: Statementstmt 100% 23 / 23 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 81.4% 35 / 43 CC 7 SCAR 17.2
CC
7
Cov
85%
authenticate
8.2
BEGIN
1.0
BEGIN
1.0
CRAP 5.6
« Simple/Adapter.pm ↑ Summary Simple/Log.pm »
1 package Authen::Simple;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Params::Validate qw[];
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '0.5';
9  
10 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
11 1 my $class = shift;
12  
13 1 my %adapter = (
14 isa => 'Authen::Simple::Adapter',
15 type => Params::Validate::OBJECT,
16 optional => 1
17 );
18  
19 1 my @spec = ( { %adapter, optional => 0 }, ( \%adapter ) x @_ );
20 1 my $adapters = Params::Validate::validate_pos( @_, @spec );
21  
22 1 return bless( $adapters, $class );
23 }
24  
25 2 ▶sub authenticate {
Subroutine authenticate: called CC=7 SCAR=21.1
Pod documented
26 2 my ( $self, $username, $password ) = @_;
27  
28 2 foreach ( $username, $password ) {
29 4 ▶ return 0 unless defined($_) && !ref($_) && length($_);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_ and not ref $_ and length $_ 0 4 4
Condition33%2/6
defined $_ and not ref $_ and length $_
!ll&&!rl&&r
004
defined $_ and not ref $_
!ll&&!rl&&r
004
MC/DC0%0/3
defined $_ and not ref $_ and length $_
defined $_ not ref $_ length $_
Truth table25%1/4
A and not(B) and C
A= defined $_B= not ref $_C= length $_
ABCresult
0XX0
10X0
1100
1111
30 }
31  
32 2 foreach my $adapter ( @{$self} ) {
33 4 ▶ return 1 if $adapter->authenticate( $username, $password );
Branch: 1 branch
BranchTrueFalseTotal
if $adapter->authenticate($username, $password) 1 3 4
34 }
35  
36 1 return 0;
37 }
38  
39 2 1;
40  
41 __END__
« Simple/Adapter.pm ↑ Summary Simple/Log.pm »