Auth/Offer.pm

filter: Statementstmt 40.6% 13 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 5 totaltotal 28.3% 17 / 60 CC 5 SCAR 20.1
CC
5
Cov
32%
_process
20.0
new
6.0
offer
2.0
CRAP 7.4
« Auth/Utils.pm ↑ Summary Auth/ApplicationToken.pm »
1 package WWW::Live::Auth::Offer;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use WWW::Live::Auth::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
10 0 my ( $proto, %args ) = @_;
11 0 ▶ my $class = ref $proto || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
12 my $self = bless {
13 'offer' => $args{'offer'},
14 'action' => $args{'action'},
15 0 'expires' => $args{'expires'}
16 }, $class;
17 0 $self->_process;
18 0 return $self;
19 }
20  
21 0 ▶sub offer {
Subroutine offer: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my ( $self ) = @_;
23 0 return $self->{'offer'};
24 }
25  
26 0 ▶sub action {
Subroutine action: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my ( $self ) = @_;
28 0 return $self->{'action'};
29 }
30  
31 0 ▶sub expires {
Subroutine expires: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my ( $self ) = @_;
33 0 return $self->{'expires'};
34 }
35  
36 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
37 0 my ( $self ) = @_;
38 0 return $self->offer . '.' . $self->action;
39 }
40  
41 0 ▶sub _process {
Subroutine _process: not called CC=4 SCAR=30.0
42 0 my ( $self ) = @_;
43 0 ▶ if ( !$self->{'action'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{"action"}) 0 0 0
44 0 my ($offer, $action, $expires) = split /[\.:]/, $self->{'offer'};
45 0 ▶ $self->{'offer'} = $offer || croak('Could not parse offer');
Condition0%0/2
$offer || croak('Could not parse offer')
l!l
00
MC/DC0%0/1
$offer || croak('Could not parse offer')
$offer
Truth table0%0/2
A
A= $offer
Aresult
11
00
46 0 ▶ $self->{'action'} = $action || croak('Could not parse offer action');
Condition0%0/2
$action || croak('Could not parse offer action')
l!l
00
MC/DC0%0/1
$action || croak('Could not parse offer action')
$action
Truth table0%0/2
A
A= $action
Aresult
11
00
47 0 $self->{'expires'}; # optional
48 }
49 }
50  
51 1 1;
52 __END__
« Auth/Utils.pm ↑ Summary Auth/ApplicationToken.pm »