Sleep/Response.pm

filter: Statementstmt 92.3% 24 / 26 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 87.5% 7 / 8 Podpod 100% 4 / 4 totaltotal 88.3% 38 / 43 CC 3 SCAR 4.1
CC
3
Cov
90%
new
2.0
location
2.0
encode
2.0
CRAP 1.5
« Sleep/Resource.pm ↑ Summary Sleep/Handler.pm »
1 package Sleep::Response;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use JSON::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
10 1 my $klass = shift;
11 1 ▶ my $args = shift || {};
Condition50%1/2
shift() || {}
l!l
10
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
12  
13 1 my $self = bless { %$args }, $klass;
14  
15 1 return $self;
16 }
17  
18 2 ▶sub data {
Subroutine data: called CC=1 SCAR=0.0
Pod documented
19 2 my $self = shift;
20 2 return $self->{data};
21 }
22  
23 0 ▶sub location {
Subroutine location: not called CC=1 SCAR=6.9
Pod documented
24 0 my $self = shift;
25 0 return $self->{location};
26 }
27  
28 2 ▶sub encode {
Subroutine encode: called CC=2 SCAR=6.9
Pod documented
29 2 my $self = shift;
30 2 my $as = shift;
31  
32 2 ▶ if ($as eq 'application/json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($as eq "application/json") 1 1 2
33 1 return encode_json($self->data());
34 }
35
36 1 croak "Can't encode";
37 }
38  
39 3 1;
40  
41 __END__
« Sleep/Resource.pm ↑ Summary Sleep/Handler.pm »