Picnic/Result.pm

filter: Statementstmt 93.7% 15 / 16 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 66.6% 24 / 36 CC 6 SCAR 17.8
CC
6
Cov
75%
BUILDARGS
7.5
BEGIN
1.0
_get
1.0
CRAP 5.9
« Picnic/Result/Search.pm ↑ Summary Picnic.pm »
1 package WWW::Picnic::Result;
2 # ABSTRACT: Base class for Picnic API result objects
3 2 our $VERSION = '0.101';
4 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6  
7 2 has raw => (
8 is => 'ro',
9 required => 1,
10 );
11  
12  
13 17 ▶sub BUILDARGS {
Subroutine BUILDARGS: called CC=6 SCAR=20.2
Pod undocumented
14 17 my ( $class, @args ) = @_;
15 17 ▶ if ( @args == 1 && ref $args[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args == 1 and ref $args[0]) 17 0 17
Condition33%1/3
@args == 1 and ref $args[0]
!ll&&!rl&&r
0017
MC/DC0%0/2
@args == 1 and ref $args[0]
@args == 1 ref $args[0]
Truth table33%1/3
A and B
A= @args == 1B= ref $args[0]
ABresult
0X0
100
111
16 17 my $ref_type = ref $args[0];
17 # Accept both HASH and ARRAY as raw data
18 17 ▶ if ( $ref_type eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref_type eq "ARRAY") 1 16 17
19 1 return { raw => $args[0] };
20 }
21 16 ▶ if ( $ref_type eq 'HASH' && !exists $args[0]->{raw} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref_type eq "HASH" and not exists $args[0]{"raw"}) 16 0 16
Condition33%1/3
$ref_type eq "HASH" and not exists $args[0]{"raw"}
!ll&&!rl&&r
0016
MC/DC0%0/2
$ref_type eq "HASH" and not exists $args[0]{"raw"}
$ref_type eq "HASH" not exists $args[0]{"raw"}
Truth table33%1/3
A and not(B)
A= $ref_type eq "HASH"B= not exists $args[0]{"raw"}
ABresult
0X0
100
111
22 16 return { raw => $args[0] };
23 }
24 }
25 0 return $class->SUPER::BUILDARGS(@args);
26 }
27  
28 39 ▶sub _get {
Subroutine _get: called CC=1 SCAR=0.0
29 39 my ( $self, $key ) = @_;
30 39 return $self->raw->{$key};
31 }
32  
33 2 1;
34  
35 __END__
« Picnic/Result/Search.pm ↑ Summary Picnic.pm »