| 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
Condition33%1/3
@args == 1 and ref $args[0]
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]
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 19 | 1 | return { raw => $args[0] }; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | 16 | ▶ | if ( $ref_type eq 'HASH' && !exists $args[0]->{raw} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ref_type eq "HASH" and not exists $args[0]{"raw"}
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"}
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||