Spore/Middleware/Auth/Basic.pm

filter: Statementstmt 100% 15 / 15 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 75.0% 21 / 28 CC 4 SCAR 12.6
CC
4
Cov
82%
call
4.8
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« Spore/Middleware/LogDispatch.pm ↑ Summary Spore/Middleware/Mock.pm »
1 package Net::HTTP::Spore::Middleware::Auth::Basic;
2 2 $Net::HTTP::Spore::Middleware::Auth::Basic::VERSION = '0.09';
3 # ABSTRACT: middleware for Basic authentication
4  
5 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 extends 'Net::HTTP::Spore::Middleware::Auth';
7  
8 2 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 has username => (isa => 'Str', is => 'rw', predicate => 'has_username');
11 2 has password => (isa => 'Str', is => 'rw', predicate => 'has_password');
12  
13 1 ▶sub call {
Subroutine call: called CC=4 SCAR=15.6
Pod undocumented
14 1 my ( $self, $req ) = @_;
15  
16 1 ▶ return unless $self->should_authenticate($req);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->should_authenticate($req) 0 1 1
17  
18 1 ▶ if ( $self->has_username && $self->has_password ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_username and $self->has_password) 1 0 1
Condition33%1/3
$self->has_username and $self->has_password
!ll&&!rl&&r
001
MC/DC0%0/2
$self->has_username and $self->has_password
$self->has_username $self->has_password
Truth table33%1/3
A and B
A= $self->has_usernameB= $self->has_password
ABresult
0X0
100
111
19 1 $req->header(
20 'Authorization' => 'Basic '
21 . MIME::Base64::encode(
22 $self->username . ':' . $self->password, ''
23 )
24 );
25 }
26 }
27  
28 2 1;
29  
30 __END__
« Spore/Middleware/LogDispatch.pm ↑ Summary Spore/Middleware/Mock.pm »