| 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'
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'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 103 | ▶ | my $ret_class = $returns ? $call_object->_returns : 'Paws::API::Response'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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'}
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'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition50%3/6
$http_status == 204 and !defined($content) || $content eq ""
not defined $content or $content eq ""
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 ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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"}
$unserialized_struct->{'requestId'} || $unserialized_struct->{'RequestId'} || $unserialized_struct->{'RequestID'} || $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
$unserialized_struct->{"requestId"} or $unserialized_struct->{"RequestId"} or $unserialized_struct->{"RequestID"}
$unserialized_struct->{"requestId"} or $unserialized_struct->{"RequestId"}
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'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 94 | ▶ | if ($call_object->can('_result_key') && $call_object->_result_key){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$call_object->can("_result_key") and $call_object->_result_key
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 94 | ▶ | if ($ret_class->can('_stream_param')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||