File Coverage

blib/lib/WWW/Picnic/Result.pm
Criterion Covered Total %
statement 11 13 84.6
branch 3 6 50.0
condition 2 6 33.3
subroutine 3 3 100.0
pod 0 1 0.0
total 19 29 65.5


line stmt bran cond sub pod time code
1             package WWW::Picnic::Result;
2             our $VERSION = '0.100';
3             our $AUTHORITY = 'cpan:GETTY';
4             # ABSTRACT: Base class for Picnic API result objects
5              
6 2     2   1054 use Moo;
  2         4  
  2         11  
7              
8              
9             has raw => (
10             is => 'ro',
11             required => 1,
12             );
13              
14              
15             sub BUILDARGS {
16 14     14 0 20647 my ( $class, @args ) = @_;
17 14 50 33     114 if ( @args == 1 && ref $args[0] ) {
18 14         42 my $ref_type = ref $args[0];
19             # Accept both HASH and ARRAY as raw data
20 14 50       43 if ( $ref_type eq 'ARRAY' ) {
21 0         0 return { raw => $args[0] };
22             }
23 14 50 33     86 if ( $ref_type eq 'HASH' && !exists $args[0]->{raw} ) {
24 14         464 return { raw => $args[0] };
25             }
26             }
27 0         0 return $class->SUPER::BUILDARGS(@args);
28             }
29              
30             sub _get {
31 36     36   138 my ( $self, $key ) = @_;
32 36         503 return $self->raw->{$key};
33             }
34              
35             1;
36              
37             __END__