Client/Response.pm

filter: Statementstmt 81.4% 22 / 27 Branchbran 0.0% 0 / 2 Conditioncond 77.7% 7 / 9 MC/DCmcdc 66.6% 4 / 6 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 5 totaltotal 69.6% 39 / 56 CC 5 SCAR 9.0
CC
5
Cov
76%
response
6.0
new
2.0
is_failure
2.0
CRAP 2.5
« Client/Response/Error.pm ↑ Summary Client/Response/Success.pm »
1 package LibCAS::Client::Response;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 our $VERSION = '0.01';
7  
8 6 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod undocumented
9 6 my $this = shift;
10 6 my %args = @_;
11
12 6 my $self = { ok => undef, response => undef};
13
14 6 map { $self->{$_} = $args{$_} } keys %args;
15  
16 6 ▶ my $class = ref($this) || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
060
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
17
18 6 bless($self, $class);
19 6 return $self;
20 }
21  
22 5 ▶sub is_error {
Subroutine is_error: called CC=1 SCAR=0.0
Pod undocumented
23 5 my $self = shift;
24 5 return ! defined $self->{ok};
25 }
26  
27 5 ▶sub is_failure {
Subroutine is_failure: called CC=2 SCAR=6.9
Pod undocumented
28 5 my $self = shift;
29 5 ▶ return (defined $self->{ok} && ! $self->{ok});
Condition100%3/3
defined $self->{'ok'} && !$self->{'ok'}
!ll&&!rl&&r
131
MC/DC100%2/2
defined $self->{'ok'} && !$self->{'ok'}
defined $self->{'ok'} !$self->{'ok'}
Truth table100%3/3
A && not(B)
A= defined $self->{'ok'}B= !$self->{'ok'}
ABresult
0X0
100
111
30 }
31  
32 5 ▶sub is_success {
Subroutine is_success: called CC=2 SCAR=6.9
Pod undocumented
33 5 my $self = shift;
34 5 ▶ return (defined $self->{ok} && $self->{ok});
Condition100%3/3
defined $self->{'ok'} && $self->{'ok'}
!ll&&!rl&&r
113
MC/DC100%2/2
defined $self->{'ok'} && $self->{'ok'}
defined $self->{'ok'} $self->{'ok'}
Truth table100%3/3
A && B
A= defined $self->{'ok'}B= $self->{'ok'}
ABresult
0X0
100
111
35 }
36  
37 0 ▶sub response {
Subroutine response: not called CC=2 SCAR=17.9
Pod undocumented
38 0 my $self = shift;
39 0 my $response = shift;
40
41 0 ▶ if (defined $response) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $response) 0 0 0
42 0 $self->{response} = $response;
43 }
44
45 0 return $self->{response};
46 }
47  
48 9 1;
« Client/Response/Error.pm ↑ Summary Client/Response/Success.pm »