blib/lib/Paws/Net/ResponseRole.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 85.7% 12 / 14 Conditioncond 70.3% 19 / 27 MC/DCmcdc 28.5% 4 / 14 Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 1 totaltotal 73.8% 65 / 88 CC 18 SCAR 29.4
CC
18
Cov
83%
response_to_object
19.9
BEGIN
1.0
CRAP 18.9
« blib/lib/Paws/ImportExport.pm ↑ Summary blib/lib/Paws/Route53.pm »
1 package Paws::Net::ResponseRole;
2 22 ▶ use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4  
5 103 ▶ sub response_to_object {
Subroutine response_to_object: called CC=18 SCAR=29.9
Pod undocumented
6 103 my ($self, $call_object, $response) = @_;
7 103 my ($http_status, $content, $headers) = ($response->status, $response->content, $response->headers);;
8  
9 103 $call_object = $call_object->meta->name;
10  
11 103 ▶ my $returns = (defined $call_object->_returns) && ($call_object->_returns ne 'Paws::API::Response');
Condition66%2/3
defined $call_object->_returns && $call_object->_returns ne 'Paws::API::Response'
!ll&&!rl&&r
0697
MC/DC50%1/2
defined $call_object->_returns && $call_object->_returns ne 'Paws::API::Response'
defined $call_object->_returns $call_object->_returns ne 'Paws::API::Response'
Truth table66%2/3
A && B
A= defined $call_object->_returnsB= $call_object->_returns ne 'Paws::API::Response'
ABresult
0X0
100
111
12 103 ▶ my $ret_class = $returns ? $call_object->_returns : 'Paws::API::Response';
Branch: 1 branch
BranchTrueFalseTotal
$returns ? : 97 6 103
13 103 Paws->load_class($ret_class);
14
15 my $request_id = $headers->{'x-amz-request-id'}
16 103 ▶ || $headers->{'x-amzn-requestid'};
Condition100%3/3
$headers->{'x-amz-request-id'} || $headers->{'x-amzn-requestid'}
l!l&&r!l&&!r
652414
MC/DC100%2/2
$headers->{'x-amz-request-id'} || $headers->{'x-amzn-requestid'}
$headers->{'x-amz-request-id'} $headers->{'x-amzn-requestid'}
Truth table100%3/3
A || B
A= $headers->{'x-amz-request-id'}B= $headers->{'x-amzn-requestid'}
ABresult
1X1
011
000
17  
18 # No need to care about parsing the response, if we aren't going
19 # to use it anyway
20 # See also: t/25_error_on_malformed_response.t
21  
22 103 ▶ return Paws::API::Response->new(
Branch: 1 branch
BranchTrueFalseTotal
unless $returns 6 97 103
23 _request_id => $request_id,
24 ) if !$returns;
25
26 97 my $unserialized_struct;
27 97 ▶ if ($ret_class->can('_stream_param')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret_class->can('_stream_param')) { } 3 94 97
28 3 $unserialized_struct = {}
29 } else {
30 ## eg when we have a 204 - No content response
31 94 ▶ if ($http_status == 204 && (not defined $content or $content eq '')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($http_status == 204 and !defined($content) || $content eq '') { } 3 91 94
Condition50%3/6
$http_status == 204 and !defined($content) || $content eq ""
!ll&&!rl&&r
9103
not defined $content or $content eq ""
l!l&&r!l&&!r
300
MC/DC33%1/3
$http_status == 204 and !defined($content) || $content eq ""
$http_status == 204 not defined $content $content eq ""
Truth table50%2/4
A and not(B) or C
A= $http_status == 204B= not defined $contentC= $content eq ""
ABCresult
0XX0
1000
11X1
1011
32 3 $unserialized_struct = {}
33 } else {
34 91 $unserialized_struct = $self->unserialize_response( $response );
35 }
36 }
37  
38 $request_id
39 ||= $unserialized_struct->{'requestId'}
40 || $unserialized_struct->{'RequestId'}
41 || $unserialized_struct->{'RequestID'}
42 94 ▶ || $unserialized_struct->{ ResponseMetadata }->{ RequestId };
Condition75%9/12
$request_id ||= $unserialized_struct->{"requestId"} || $unserialized_struct->{"RequestId"} || $unserialized_struct->{"RequestID"} || $unserialized_struct->{"ResponseMetadata"}{"RequestId"}
l!l&&r!l&&!r
80113
$unserialized_struct->{'requestId'} || $unserialized_struct->{'RequestId'} || $unserialized_struct->{'RequestID'} || $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
l!l&&r!l&&!r
1013
$unserialized_struct->{"requestId"} or $unserialized_struct->{"RequestId"} or $unserialized_struct->{"RequestID"}
l!l&&r!l&&!r
1013
$unserialized_struct->{"requestId"} or $unserialized_struct->{"RequestId"}
l!l&&r!l&&!r
0113
MC/DC0%0/5
$request_id ||= $unserialized_struct->{"requestId"} || $unserialized_struct->{"RequestId"} || $unserialized_struct->{"RequestID"} || $unserialized_struct->{"ResponseMetadata"}{"RequestId"}
$request_id $unserialized_struct->{"requestId"} $unserialized_struct->{"RequestId"} $unserialized_struct->{"RequestID"} $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
Truth table0%0/6
A ||= B or C or D || E
A= $request_idB= $unserialized_struct->{"requestId"}C= $unserialized_struct->{"RequestId"}D= $unserialized_struct->{"RequestID"}E= $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
43
44 94 ▶ if ($call_object->can('_result_key') && $call_object->_result_key){
Branch: 1 branch
BranchTrueFalseTotal
if ($call_object->can("_result_key") and $call_object->_result_key) 0 94 94
Condition66%2/3
$call_object->can("_result_key") and $call_object->_result_key
!ll&&!rl&&r
20740
MC/DC0%0/2
$call_object->can("_result_key") and $call_object->_result_key
$call_object->can("_result_key") $call_object->_result_key
Truth table66%2/3
A and B
A= $call_object->can("_result_key")B= $call_object->_result_key
ABresult
0X0
100
111
45 0 $unserialized_struct = $unserialized_struct->{ $call_object->_result_key };
46 }
47  
48 94 $unserialized_struct->{ _request_id } = $request_id;
49
50 94 ▶ if ($returns){
Branch: 1 branch
BranchTrueFalseTotal
if ($returns) { } 94 0 94
51 94 ▶ if ($ret_class->can('_stream_param')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret_class->can("_stream_param")) 3 91 94
52 3 $unserialized_struct->{ $ret_class->_stream_param } = $content
53 }
54  
55 94 foreach my $key (keys %$headers){
56 512 $unserialized_struct->{lc $key} = $headers->{$key};
57 }
58  
59 94 my $o_result = $self->new_from_result_struct($call_object->_returns, $unserialized_struct);
60 94 return $o_result;
61 } else {
62 0 return Paws::API::Response->new(
63 _request_id => $request_id,
64 );
65 }
66 }
67  
68 22 1;
« blib/lib/Paws/ImportExport.pm ↑ Summary blib/lib/Paws/Route53.pm »