| 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
Condition33%2/6
defined $_ and not ref $_ and length $_
defined $_ and not ref $_
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 $_
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | foreach my $adapter ( @{$self} ) { | |||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | ▶ | return 1 if $adapter->authenticate( $username, $password ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | __END__ | ||||||||||||||||||||||||||||||||||||||||||