blib/lib/Paws/API/JSONAttribute.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 87.5% 35 / 40 CC 3 SCAR 5.4
CC
3
Cov
88%
__ANON__
3.1
Policy
1.1
__ANON__
1.1
CRAP 1.7
« blib/lib/Paws/Net/LWPCaller.pm ↑ Summary blib/lib/Paws/Credential/File.pm »
1 package Paws::API::JSONAttribute;
2 35 ▶ use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 34 Moose::Util::meta_attribute_alias('JSONAttribute');
4  
5 35 ▶ use JSON::MaybeXS;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 35 ▶ use URL::Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 34 has method => (is => 'rw', isa => 'Str', required => 1);
9 34 has decode_as => (is => 'rw', isa => 'Str', required => 1);
10  
11 3 ▶ after 'install_accessors' => sub {
Subroutine __ANON__: called CC=3 SCAR=11.3
12 3 my $self = shift;
13 3 my $realclass = $self->associated_class();
14 3 my $closure = $self->name;
15  
16 3 my $coderef;
17 3 ▶ if ($self->decode_as eq 'JSON') {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->decode_as eq 'JSON') { } 1 2 3
elsif ($self->decode_as eq 'URLJSON') { } 2 0 2
18 57 ▶ $coderef = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
19 57 my $self = shift;
20 57 return decode_json($self->$closure());
21 1 };
22 } elsif ($self->decode_as eq 'URLJSON') {
23 0 ▶ $coderef = sub {
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine Policy: called CC=1 SCAR=1.2
24 0 my $self = shift;
25 0 return decode_json(URL::Encode::url_decode($self->$closure()));
26 2 };
27 } else {
28 0 die "Unrecognized JSONAttribute decode_as attribute";
29 }
30  
31 3 $realclass->add_method( $self->method => $coderef );
32 34 };
33  
34 34 1;
« blib/lib/Paws/Net/LWPCaller.pm ↑ Summary blib/lib/Paws/Credential/File.pm »