API/Botocore/Shape.pm

filter: Statementstmt 68.8% 268 / 389 Branchbran 43.7% 84 / 192 Conditioncond 46.1% 97 / 210 MC/DCmcdc 12.8% 15 / 117 Subroutinesub 85.7% 48 / 56 Podpod 8.3% 1 / 12 totaltotal 52.5% 513 / 976 CC 190 SCAR 50.6
CC
190
Cov
57%
finalize_structure
453.5
finalize_list
210.7
finalize_map
173.6
CRAP 157.3
« API/Botocore/Shape/Serializer.pm ↑ Summary API/Error.pm »
1 package Amazon::API::Botocore::Shape;
2  
3 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 14 our $VERSION = '2.8.2';
7  
8 14 ▶use parent qw(Exporter Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 14 ▶use Amazon::API::Constants qw(:chars :booleans);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 14 ▶use Amazon::API::Botocore::Shape::Utils qw(flatten require_shape check_type check_pattern check_enum _check );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 14 ▶use Amazon::API::NullLogger;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 14 ▶use Carp qw(croak confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 14 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 14 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 14 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 14 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 14 ▶use Scalar::Util qw( reftype blessed looks_like_number );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 14 ▶use List::Util qw( any pairs none );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 14 ▶use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 14 __PACKAGE__->follow_best_practice;
24 14 __PACKAGE__->mk_accessors(
25 qw(
26 document
27 documentation
28 enum
29 flattened
30 logger
31 location
32 locationName
33 key
34 value
35 max
36 member
37 members
38 min
39 paginator
40 pattern
41 required
42 service
43 shape
44 streaming
45 timestampFormat
46 type
47 _value
48 xmlNamespace
49 )
50 );
51  
52 14 our $PROTOCOL;
53 14 our $LOGGER_SOURCE;
54  
55 # request-side value validation mode (enum/min/max/pattern) is the canonical
56 # global $Amazon::API::VALIDATE_MODE: 'strict' (default) croaks, 'warn' carps and
57 # passes through, 'off' skips. Amazon::API sets the default; localize it for
58 # per-call override: local $Amazon::API::VALIDATE_MODE = 'off';
59  
60 ########################################################################
61 66 ▶sub new {
Subroutine new: called CC=3 SCAR=11.4
Pod documented
62 ########################################################################
63 66 my ( $class, $args, $is_response ) = @_;
64  
65 66 my $self = $class->SUPER::new($args);
66  
67 66 ▶ $self->set_logger(
Branch: 1 branch
BranchTrueFalseTotal
$Amazon::API::Botocore::Shape::LOGGER_SOURCE ? : 23 43 66
68 $LOGGER_SOURCE
69 ? $LOGGER_SOURCE->($class)
70 : Amazon::API::NullLogger->new
71 );
72  
73 66 ▶ if ($is_response) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_response) 0 66 66
74 0 $self->set__value(undef);
75 0 return;
76 }
77  
78 66 $self->_init_value;
79  
80 61 return $self;
81 }
82  
83 ########################################################################
84 38 ▶sub is_structure {
Subroutine is_structure: called CC=1 SCAR=0.0
Pod undocumented
85 ########################################################################
86 38 my ($self) = @_;
87  
88 38 return $self->get_type eq 'structure';
89 }
90  
91 ########################################################################
92 23 ▶sub is_list {
Subroutine is_list: called CC=1 SCAR=0.0
Pod undocumented
93 ########################################################################
94 23 my ($self) = @_;
95  
96 23 return $self->get_type eq 'list';
97 }
98  
99 ########################################################################
100 0 ▶sub is_string {
Subroutine is_string: not called CC=1 SCAR=6.9
Pod undocumented
101 ########################################################################
102 0 my ($self) = @_;
103  
104 0 return $self->get_type eq 'string';
105 }
106  
107 ########################################################################
108 0 ▶sub is_integer {
Subroutine is_integer: not called CC=1 SCAR=6.9
Pod undocumented
109 ########################################################################
110 0 my ($self) = @_;
111  
112 0 return $self->get_type eq 'integer';
113 }
114  
115 ########################################################################
116 39 ▶sub is_map {
Subroutine is_map: called CC=1 SCAR=0.0
Pod undocumented
117 ########################################################################
118 39 my ($self) = @_;
119  
120 39 return $self->get_type eq 'map';
121 }
122  
123 ########################################################################
124 2 ▶sub is_flattened {
Subroutine is_flattened: called CC=1 SCAR=0.0
Pod undocumented
125 ########################################################################
126 2 my ($self) = @_;
127  
128 2 return $self->get_flattened;
129 }
130  
131 ########################################################################
132 15 ▶sub _init_structure {
Subroutine _init_structure: called CC=8 SCAR=21.6
133 ########################################################################
134 15 my ($self) = @_;
135  
136 15 my $value = $self->get__value;
137  
138 15 ▶ foreach my $member ( @{ $self->get_required // [] } ) {
Condition100%2/2
$self->get_required // []
l!l
96
MC/DC100%1/1
$self->get_required // []
$self->get_required
Truth table100%2/2
A
A= $self->get_required
Aresult
11
00
139 croak "$member is a required parameter"
140 15 ▶ if !any { $_ eq $member } keys %{$value};
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 1 branch
BranchTrueFalseTotal
unless &any(sub { $_ eq $member; } , keys %{$value;}) 0 15 15
141 }
142  
143 15 my %result = %{$value}; # do not alter input!
144  
145 15 foreach my $member ( keys %{ $self->get_members } ) {
146 48 my $member_config = $self->get_members->{$member};
147  
148 48 ▶ if ( $member_config->{idempotencyToken}
Branch: 1 branch
BranchTrueFalseTotal
if ($member_config->{"idempotencyToken"} and not exists $result{$member}) 0 48 48
Condition33%1/3
$member_config->{"idempotencyToken"} and not exists $result{$member}
!ll&&!rl&&r
4800
MC/DC0%0/2
$member_config->{"idempotencyToken"} and not exists $result{$member}
$member_config->{"idempotencyToken"} not exists $result{$member}
Truth table33%1/3
A and not(B)
A= $member_config->{"idempotencyToken"}B= not exists $result{$member}
ABresult
0X0
100
111
149 && !exists $result{$member} ) {
150 0 require Data::UUID;
151  
152 0 my $ug = Data::UUID->new;
153  
154 0 $result{$member} = lc $ug->create_str;
155 }
156  
157 48 ▶ if ( exists $result{$member} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $result{$member}) 30 18 48
158 30 my $val = $result{$member};
159  
160 30 my $class = require_shape( $member_config->{shape}, $self->get_service, );
161  
162 30 $result{$member} = $class->new($val);
163 }
164 }
165  
166 15 return \%result;
167 }
168  
169 ########################################################################
170 1 ▶sub _init_map {
Subroutine _init_map: called CC=7 SCAR=19.6
171 ########################################################################
172 1 my ($self) = @_;
173  
174 1 my $value = $self->get__value;
175  
176 1 ▶ return $value
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_flattened 0 1 1
177 if $self->is_flattened;
178  
179 1 ▶ if ( ref $value eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value eq "HASH") 1 0 1
180 1 $value = [$value];
181 }
182  
183 1 foreach my $elem ( @{$value} ) {
184 1 ▶ croak 'elements of a map must be of type HASH'
Branch: 1 branch
BranchTrueFalseTotal
if ref $elem ne "HASH" 0 1 1
185 if ref($elem) ne 'HASH';
186 }
187  
188 1 my @list;
189  
190 1 my $value_class = require_shape( $self->get_value->{shape}, $self->get_service );
191  
192 1 foreach my $elem ( @{$value} ) {
193 1 my @kv = %{$elem};
194 # Use the plain key string as the hash key - NOT $key_class->new($kv[0]),
195 # which Perl would stringify into a blessed-object ref, destroying the
196 # real key value. Use pairs to process ALL key-value pairs in the element,
197 # not just the first ($kv[0]/$kv[1]) which would drop all but one entry
198 # from multi-key maps like Lambda EnvironmentMap.
199 1 for my $pair ( pairs @kv ) {
200 1 my ( $k, $v ) = @{$pair};
201 1 push @list, { $k => $value_class->new($v) };
202 }
203 }
204  
205 1 $value = \@list;
206  
207 1 return $value;
208 }
209  
210 ########################################################################
211 2 ▶sub _init_list {
Subroutine _init_list: called CC=6 SCAR=20.5
212 ########################################################################
213 2 my ($self) = @_;
214  
215 2 my $value = $self->get__value;
216  
217 0 ▶ _check( !$self->get_max || @{$value} <= $self->get_max, q{more than } . ( $self->get_max // q{} ) . q{ elements in list} );
Condition40%2/5
!$self->get_max || @{$value;} <= $self->get_max
l!l&&r!l&&!r
200
$self->get_max // ""
l!l
02
MC/DC0%0/2
!$self->get_max || @{$value;} <= $self->get_max
!$self->get_max @{$value;} <= $self->get_max
MC/DC0%0/1
$self->get_max // ""
$self->get_max
Truth table33%1/3
not(A) || B
A= !$self->get_maxB= @{$value;} <= $self->get_max
ABresult
1X1
011
000
Truth table50%1/2
A
A= $self->get_max
Aresult
11
00
218  
219 0 ▶ _check( !$self->get_min || @{$value} >= $self->get_min,
Condition40%2/5
!$self->get_min || @{$value;} >= $self->get_min
l!l&&r!l&&!r
200
$self->get_min // ""
l!l
02
MC/DC0%0/2
!$self->get_min || @{$value;} >= $self->get_min
!$self->get_min @{$value;} >= $self->get_min
MC/DC0%0/1
$self->get_min // ""
$self->get_min
Truth table33%1/3
not(A) || B
A= !$self->get_minB= @{$value;} >= $self->get_min
ABresult
1X1
011
000
Truth table50%1/2
A
A= $self->get_min
Aresult
11
00
220 q{need at least } . ( $self->get_min // q{} ) . q{ elements in list} );
221  
222 2 my $class = require_shape( $self->get_member->{shape}, $self->get_service );
223  
224 # do not alter the input!
225 2 my @list;
226  
227 2 foreach my $elem ( @{$value} ) {
228 2 push @list, $class->new($elem);
229 }
230  
231 2 return \@list;
232 }
233  
234 ########################################################################
235 24 ▶sub _init_string {
Subroutine _init_string: called CC=5 SCAR=16.1
236 ########################################################################
237 24 my ($self) = @_;
238  
239 24 my $value = $self->get__value;
240  
241 24 my $pattern = $self->get_pattern;
242  
243 24 check_pattern( $value, $pattern );
244  
245 23 check_enum( $value, $self->get_enum );
246  
247 22 ▶ _check( !$self->get_min || length $value >= $self->get_min, q{length of value must be >= } . ( $self->get_min // q{} ) );
Condition100%5/5
!$self->get_min || length $value >= $self->get_min
l!l&&r!l&&!r
1912
$self->get_min // ""
l!l
319
MC/DC100%2/2
!$self->get_min || length $value >= $self->get_min
!$self->get_min length $value >= $self->get_min
MC/DC100%1/1
$self->get_min // ""
$self->get_min
Truth table100%3/3
not(A) || B
A= !$self->get_minB= length $value >= $self->get_min
ABresult
1X1
011
000
Truth table100%2/2
A
A= $self->get_min
Aresult
11
00
248  
249 21 ▶ _check( !$self->get_max || length $value <= $self->get_max, q{length of value must be <= } . ( $self->get_max // q{} ) );
Condition100%5/5
!$self->get_max || length $value <= $self->get_max
l!l&&r!l&&!r
1911
$self->get_max // ""
l!l
219
MC/DC100%2/2
!$self->get_max || length $value <= $self->get_max
!$self->get_max length $value <= $self->get_max
MC/DC100%1/1
$self->get_max // ""
$self->get_max
Truth table100%3/3
not(A) || B
A= !$self->get_maxB= length $value <= $self->get_max
ABresult
1X1
011
000
Truth table100%2/2
A
A= $self->get_max
Aresult
11
00
250  
251 20 return $value;
252 }
253  
254 ########################################################################
255 2 ▶sub _init_integer {
Subroutine _init_integer: called CC=5 SCAR=18.9
256 ########################################################################
257 2 my ($self) = @_;
258  
259 2 my $value = $self->get__value;
260  
261 2 ▶ _check( !defined $self->get_min || $value >= $self->get_min, q{value must be >= } . ( $self->get_min // q{} ) );
Condition40%2/5
!defined($self->get_min) || $value >= $self->get_min
l!l&&r!l&&!r
020
$self->get_min // ""
l!l
20
MC/DC0%0/2
!defined($self->get_min) || $value >= $self->get_min
!defined($self->get_min) $value >= $self->get_min
MC/DC0%0/1
$self->get_min // ""
$self->get_min
Truth table33%1/3
not(A) || B
A= !defined($self->get_min)B= $value >= $self->get_min
ABresult
1X1
011
000
Truth table50%1/2
A
A= $self->get_min
Aresult
11
00
262  
263 2 ▶ _check( !defined $self->get_max || $value <= $self->get_max, q{value must be <= } . ( $self->get_max // q{} ) );
Condition40%2/5
!defined($self->get_max) || $value <= $self->get_max
l!l&&r!l&&!r
002
$self->get_max // ""
l!l
20
MC/DC0%0/2
!defined($self->get_max) || $value <= $self->get_max
!defined($self->get_max) $value <= $self->get_max
MC/DC0%0/1
$self->get_max // ""
$self->get_max
Truth table33%1/3
not(A) || B
A= !defined($self->get_max)B= $value <= $self->get_max
ABresult
1X1
011
000
Truth table50%1/2
A
A= $self->get_max
Aresult
11
00
264  
265 1 return $value;
266 }
267  
268 ########################################################################
269 66 ▶sub _init_value {
Subroutine _init_value: called CC=11 SCAR=24.7
270 ########################################################################
271 66 my ($self) = @_;
272  
273 66 my $value = $self->get__value;
274  
275 return
276 66 ▶ if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 3 63 66
277  
278 63 ▶ if ( $self->get_document ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_document) 0 63 63
279 0 $self->set__value($value);
280  
281 0 return $value;
282 }
283  
284 # timestamp members accept an epoch or any object that can ->epoch
285 # (Time::Piece, DateTime - duck-typed, never loaded here). Coerce to epoch
286 # now so it satisfies the SCALAR guard below and formats downstream.
287 63 ▶ if ( $self->get_type eq 'timestamp' && blessed $value && $value->can('epoch') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->get_type eq "timestamp" and builtin::blessed($value) and $value->can("epoch")) 2 61 63
Condition83%5/6
$self->get_type eq "timestamp" and builtin::blessed($value) and $value->can("epoch")
!ll&&!rl&&r
6102
$self->get_type eq "timestamp" and builtin::blessed($value)
!ll&&!rl&&r
51102
MC/DC66%2/3
$self->get_type eq "timestamp" and builtin::blessed($value) and $value->can("epoch")
$self->get_type eq "timestamp" builtin::blessed($value) $value->can("epoch")
Truth table75%3/4
A and B and C
A= $self->get_type eq "timestamp"B= builtin::blessed($value)C= $value->can("epoch")
ABCresult
0XX0
10X0
1100
1111
288 2 $value = $value->epoch;
289 2 $self->set__value($value);
290 }
291  
292 63 ▶ croak 'ref type of value should be one of SCALAR, ARRAY or HASH'
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($value) and builtin::reftype($value) ne "SCALAR" 0 63 63
Condition33%1/3
builtin::blessed($value) and builtin::reftype($value) ne "SCALAR"
!ll&&!rl&&r
6300
MC/DC0%0/2
builtin::blessed($value) and builtin::reftype($value) ne "SCALAR"
builtin::blessed($value) builtin::reftype($value) ne "SCALAR"
Truth table33%1/3
A and B
A= builtin::blessed($value)B= builtin::reftype($value) ne "SCALAR"
ABresult
0X0
100
111
293 if blessed $value && reftype($value) ne 'SCALAR';
294  
295 63 my %types = (
296 structure => 'HASH',
297 list => 'ARRAY',
298 map => [ 'ARRAY', 'HASH' ],
299 string => 'SCALAR',
300 integer => 'SCALAR',
301 long => 'SCALAR',
302 timestamp => 'SCALAR',
303 double => 'SCALAR',
304 float => 'SCALAR',
305 boolean => 'SCALAR',
306 blob => 'SCALAR',
307 );
308  
309 63 my $required_type = $types{ $self->get_type };
310  
311 63 ▶ my $actual_type = ref($value) ? reftype($value) : 'SCALAR';
Branch: 1 branch
BranchTrueFalseTotal
ref $value ? : 18 45 63
312  
313 63 ▶ check_type( $required_type, $actual_type )
Branch: 1 branch
BranchTrueFalseTotal
check_type($required_type, $actual_type) or croak(sprintf('%s requires a value of type %s', ref $self, $required_type)) 63 0 63
314 or croak sprintf '%s requires a value of type %s', ref $self,
315 $required_type;
316  
317 my %init_value_subs = (
318 15 ▶ structure => sub { $self->_init_structure },
Subroutine __ANON__: called CC=1 SCAR=0.0
319 1 ▶ map => sub { $self->_init_map },
Subroutine __ANON__: called CC=1 SCAR=0.0
320 2 ▶ list => sub { $self->_init_list },
Subroutine __ANON__: called CC=1 SCAR=0.0
321 24 ▶ string => sub { $self->_init_string },
Subroutine __ANON__: called CC=1 SCAR=0.0
322 2 ▶ integer => sub { $self->_init_integer },
Subroutine __ANON__: called CC=1 SCAR=0.0
323 63 );
324  
325 63 ▶ my $sub = $init_value_subs{ $self->get_type } // sub { return $value };
Subroutine __ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$init_value_subs{$self->get_type} // sub { return $value; }
l!l&&r!l&&!r
44190
MC/DC0%0/2
$init_value_subs{$self->get_type} // sub { return $value; }
$init_value_subs{$self->get_type} sub { return $value; }
Truth table66%2/3
A // B
A= $init_value_subs{$self->get_type}B= sub { return $value; }
ABresult
1X1
011
000
326  
327 63 $self->set__value( $sub->() );
328  
329 58 return $value;
330 }
331  
332 ########################################################################
333 39 ▶sub get_shape_type {
Subroutine get_shape_type: called CC=5 SCAR=16.1
Pod undocumented
334 ########################################################################
335 39 my ($self) = @_;
336  
337 39 ▶ return 'SCALAR'
Branch: 1 branch
BranchTrueFalseTotal
if $self->get_document 0 39 39
338 if $self->get_document;
339  
340 39 ▶ return 'MAP'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_map 1 38 39
341 if $self->is_map;
342  
343 38 ▶ return 'STRUCTURE'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_structure 15 23 38
344 if $self->is_structure;
345  
346 23 ▶ return 'LIST'
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_list 2 21 23
347 if $self->is_list;
348  
349 21 return 'SCALAR';
350 }
351  
352 # 'finalization' of a shape is done in order to create a data structure
353 # that can then be used to create a Botocore request
354 ########################################################################
355 39 ▶sub finalize {
Subroutine finalize: called CC=4 SCAR=18.1
Pod undocumented
356 ########################################################################
357 39 my ( $self, $protocol ) = @_;
358  
359 39 ▶ local $PROTOCOL = $protocol
Branch: 1 branch
BranchTrueFalseTotal
if defined $protocol 18 21 39
360 if defined $protocol;
361  
362 39 ▶ $self->get_logger->debug( 'returning because ' . ref($self) . ' is not blessed?' )
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($self) 0 39 39
363 if !blessed $self;
364  
365 39 ▶ return $self
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($self) 0 39 39
366 if !blessed $self;
367  
368 $self->get_logger->trace(
369 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
370 0 return Dumper(
371 [ type => $self->get_type,
372 shape_type => $self->get_shape_type,
373 shape => $self,
374 protocol => $PROTOCOL,
375 ]
376 );
377 }
378 39 );
379  
380 my %dispatch = (
381 21 ▶ SCALAR => sub {
Subroutine __ANON__: called CC=17 SCAR=44.3
382 21 my $type = $self->get_type;
383  
384 21 my $val = $self->get__value;
385  
386 21 $self->get_logger->trace(
387 Dumper(
388 [ type => $type,
389 val => $val
390 ]
391 )
392 );
393  
394 21 ▶ if ( $type eq 'integer' || $type eq 'long' ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($type eq 'integer' or $type eq 'long') { } 0 21 21
elsif ($type eq 'float' or $type eq 'double') { } 0 21 21
elsif ($type eq 'boolean') { } 0 21 21
elsif ($type eq 'blob') { } 8 13 21
Condition33%1/3
$type eq "integer" or $type eq "long"
l!l&&r!l&&!r
0021
MC/DC0%0/2
$type eq "integer" or $type eq "long"
$type eq "integer" $type eq "long"
Truth table33%1/3
A or B
A= $type eq "integer"B= $type eq "long"
ABresult
1X1
011
000
395 0 ▶ return defined $val ? $val + 0 : $val;
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 0 0 0
396 }
397 ▶ elsif ( $type eq 'float' || $type eq 'double' ) {
Condition33%1/3
$type eq "float" or $type eq "double"
l!l&&r!l&&!r
0021
MC/DC0%0/2
$type eq "float" or $type eq "double"
$type eq "float" $type eq "double"
Truth table33%1/3
A or B
A= $type eq "float"B= $type eq "double"
ABresult
1X1
011
000
398 return $val
399 if defined $val
400 0 ▶ && any { $val eq $_ } qw(NaN Infinity -Infinity);
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if defined $val and &any(sub { $val eq $_; } , "NaN", "Infinity", "-Infinity") 0 0 0
Condition0%0/3
defined $val and &any(sub { $val eq $_; } , "NaN", "Infinity", "-Infinity")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $val and &any(sub { $val eq $_; } , "NaN", "Infinity", "-Infinity")
defined $val &any(sub { $val eq $_; } , "NaN", "Infinity", "-Infinity")
Truth table0%0/3
A and B
A= defined $valB= &any(sub { $val eq $_; } , "NaN", "Infinity", "-Infinity")
ABresult
0X0
100
111
401  
402 0 ▶ return defined $val ? $val * 1.0 : $val;
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 0 0 0
403 }
404 elsif ( $type eq 'boolean' ) {
405 return $val ? 'true' : 'false'
406 0 ▶ if $PROTOCOL && any { $PROTOCOL eq $_ } qw( ec2 query rest-xml );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 2 branches
BranchTrueFalseTotal
if $Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "ec2", "query", "rest-xml") 0 0 0
$val ? : 0 0 0
Condition0%0/3
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "ec2", "query", "rest-xml")
!ll&&!rl&&r
000
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "ec2", "query", "rest-xml")
$Amazon::API::Botocore::Shape::PROTOCOL &any(sub { $PROTOCOL eq $_; } , "ec2", "query", "rest-xml")
Truth table0%0/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= &any(sub { $PROTOCOL eq $_; } , "ec2", "query", "rest-xml")
ABresult
0X0
100
111
407  
408 0 ▶ return $val ? JSON::PP::true : JSON::PP::false;
Branch: 1 branch
BranchTrueFalseTotal
$val ? : 0 0 0
409 }
410 elsif ( $type eq 'blob' ) {
411 # value blobs (KMS Plaintext, Kinesis Data, ...) are base64 on the
412 # wire for every protocol. Streaming blobs (an S3 PutObject body)
413 # are the raw payload and must pass through untouched.
414 8 ▶ return $val
Branch: 1 branch
BranchTrueFalseTotal
if not defined $val or $self->get_streaming 2 6 8
Condition100%3/3
not defined $val or $self->get_streaming
l!l&&r!l&&!r
116
MC/DC100%2/2
not defined $val or $self->get_streaming
not defined $val $self->get_streaming
Truth table100%3/3
not(A) or B
A= not defined $valB= $self->get_streaming
ABresult
1X1
011
000
415 if !defined $val || $self->get_streaming;
416  
417 6 require MIME::Base64;
418 6 return MIME::Base64::encode_base64( $val, $EMPTY );
419 }
420  
421 13 return $val;
422 },
423 1 ▶ MAP => sub { return $self->finalize_map },
Subroutine __ANON__: called CC=1 SCAR=0.0
424 2 ▶ LIST => sub { return $self->finalize_list },
Subroutine __ANON__: called CC=1 SCAR=0.0
425 15 ▶ STRUCTURE => sub { return $self->finalize_structure },
Subroutine __ANON__: called CC=1 SCAR=0.0
426 39 );
427  
428 39 return $dispatch{ $self->get_shape_type }->();
429 }
430  
431 ########################################################################
432 1 ▶sub finalize_map {
Subroutine finalize_map: called CC=25 SCAR=51.6
Pod undocumented
433 ########################################################################
434 1 my ($self) = @_;
435  
436 1 my $location_name = $self->{locationName};
437  
438 1 my ( $key, $value ) = @{$self}{qw(key value)};
439  
440 my $is_query_protocol = $PROTOCOL
441 1 ▶ && any { $PROTOCOL eq $_ } qw(query ec2);
Subroutine __ANON__: called CC=1 SCAR=0.6
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL && &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
!ll&&!rl&&r
001
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL && &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
$Amazon::API::Botocore::Shape::PROTOCOL &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
Truth table33%1/3
A && B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
ABresult
0X0
100
111
442  
443 1 ▶ my $is_xml_protocol = $PROTOCOL
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL && $Amazon::API::Botocore::Shape::PROTOCOL eq 'rest-xml'
!ll&&!rl&&r
010
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL && $Amazon::API::Botocore::Shape::PROTOCOL eq 'rest-xml'
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq 'rest-xml'
Truth table33%1/3
A && B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq 'rest-xml'
ABresult
0X0
100
111
444 && $PROTOCOL eq 'rest-xml';
445  
446 1 ▶ my $is_entry_map_protocol = $is_query_protocol || $is_xml_protocol;
Condition33%1/3
$is_query_protocol || $is_xml_protocol
l!l&&r!l&&!r
100
MC/DC0%0/2
$is_query_protocol || $is_xml_protocol
$is_query_protocol $is_xml_protocol
Truth table33%1/3
A || B
A= $is_query_protocolB= $is_xml_protocol
ABresult
1X1
011
000
447  
448 1 my $key_location_name = $key->{locationName};
449 1 my $value_location_name = $value->{locationName};
450  
451 1 ▶ my $key_name = $key_location_name // ( $is_entry_map_protocol ? 'key' : undef );
Branch: 1 branch
BranchTrueFalseTotal
$is_entry_map_protocol ? : 0 0 0
Condition50%1/2
$key_location_name // ($is_entry_map_protocol ? "key" : undef)
l!l
10
MC/DC0%0/1
$key_location_name // ($is_entry_map_protocol ? "key" : undef)
$key_location_name
Truth table50%1/2
A
A= $key_location_name
Aresult
11
00
452  
453 1 ▶ my $value_name = $value_location_name // ( $is_entry_map_protocol ? 'value' : undef );
Branch: 1 branch
BranchTrueFalseTotal
$is_entry_map_protocol ? : 0 0 0
Condition50%1/2
$value_location_name // ($is_entry_map_protocol ? "value" : undef)
l!l
10
MC/DC0%0/1
$value_location_name // ($is_entry_map_protocol ? "value" : undef)
$value_location_name
Truth table50%1/2
A
A= $value_location_name
Aresult
11
00
454  
455 1 my @elem_list = eval {
456 1 my $values = $self->get__value;
457  
458 1 ▶ return @{$values}
Branch: 1 branch
BranchTrueFalseTotal
if builtin::reftype($values) ne "HASH" 1 0 1
459 if reftype($values) ne 'HASH';
460  
461 return map {
462 0 { $_ => $values->{$_} }
463 0 } keys %{$values};
464 };
465  
466 1 ▶ my $list
Branch: 1 branch
BranchTrueFalseTotal
defined $key_name ? : 1 0 1
467 = defined $key_name
468 ? _create_key_value_list( $key_name, $value_name, @elem_list, )
469 : [@elem_list];
470  
471 1 ▶ return flatten( $location_name, $list )
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_flattened 0 1 1
472 if $self->is_flattened;
473  
474 1 ▶ if ($is_query_protocol) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_query_protocol) 1 0 1
475 1 my %indexed;
476 1 my $idx = 1;
477  
478 1 foreach my $entry ( @{$list} ) {
479 1 $indexed{ 'entry.' . $idx++ } = $entry;
480 }
481  
482 1 ▶ return $location_name
Branch: 1 branch
BranchTrueFalseTotal
$location_name ? : 0 1 1
483 ? { $location_name => \%indexed }
484 : \%indexed;
485 }
486  
487 0 ▶ if ($is_xml_protocol) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_xml_protocol) 0 0 0
488 0 my @entries;
489  
490 0 foreach my $item (@elem_list) {
491 0 for my $pair ( pairs %{$item} ) {
492 0 my ( $k, $v ) = @{$pair};
493  
494 0 my $key_value = _apply_local_xml_namespace( $k, $key->{xmlNamespace}, );
495  
496 0 ▶ my $value_value
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($v) ? : 0 0 0
497 = blessed $v
498 ? $v->finalize
499 : $v;
500  
501 0 $value_value = _apply_local_xml_namespace( $value_value, $value->{xmlNamespace}, );
502  
503 0 push @entries,
504 {
505 $key_name => $key_value,
506 $value_name => $value_value,
507 };
508 }
509 }
510  
511 0 my $entries = { entry => \@entries, };
512  
513 0 ▶ return $location_name
Branch: 1 branch
BranchTrueFalseTotal
$location_name ? : 0 0 0
514 ? { $location_name => $entries }
515 : $entries;
516 }
517  
518 0 ▶ if ( !defined $key_name ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $key_name) 0 0 0
519 0 my %plain;
520  
521 0 for my $item (@elem_list) {
522 0 for my $pair ( pairs %{$item} ) {
523 0 my ( $k, $v ) = @{$pair};
524  
525 0 ▶ $plain{$k}
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($v) ? : 0 0 0
526 = blessed $v
527 ? $v->finalize
528 : $v;
529 }
530 }
531  
532 0 ▶ return $location_name
Branch: 1 branch
BranchTrueFalseTotal
$location_name ? : 0 0 0
533 ? { $location_name => \%plain }
534 : \%plain;
535 }
536  
537 0 ▶ return $location_name
Branch: 1 branch
BranchTrueFalseTotal
$location_name ? : 0 0 0
538 ? { $location_name => $list }
539 : $list;
540 }
541  
542 # @list is an array of key/value hashes
543 ########################################################################
544 1 ▶sub _create_key_value_list {
Subroutine _create_key_value_list: called CC=3 SCAR=11.0
545 ########################################################################
546 1 my ( $key, $value, @list ) = @_;
547  
548 1 my @kv_list;
549  
550 1 foreach my $p ( pairs map { %{$_} } @list ) {
551 1 my ( $k, $v ) = @{$p};
552  
553 1 ▶ push @kv_list,
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($v) ? : 1 0 1
554 {
555 $key => $k,
556 $value => blessed $v ? $v->finalize : $v,
557 };
558  
559 }
560  
561 1 return \@kv_list;
562 }
563  
564 ########################################################################
565 2 ▶sub finalize_list {
Subroutine finalize_list: called CC=26 SCAR=53.5
Pod undocumented
566 ########################################################################
567 2 my ($self) = @_;
568  
569 2 my $member = $self->get_member;
570  
571 2 my $location_name = $member->{locationName};
572  
573 2 my @list;
574  
575 2 foreach my $elem ( @{ $self->get__value } ) {
576 2 my $value;
577  
578 2 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq 'rest-xml' and builtin::blessed($elem) and $elem->can('get_type') and $elem->get_type eq 'timestamp') { } 0 2 2
Condition33%4/12
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and builtin::blessed($elem) and $elem->can("get_type") and $elem->get_type eq "timestamp"
!ll&&!rl&&r
020
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and builtin::blessed($elem) and $elem->can("get_type")
!ll&&!rl&&r
002
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and builtin::blessed($elem)
!ll&&!rl&&r
002
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
!ll&&!rl&&r
002
MC/DC0%0/5
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and builtin::blessed($elem) and $elem->can("get_type") and $elem->get_type eq "timestamp"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" builtin::blessed($elem) $elem->can("get_type") $elem->get_type eq "timestamp"
Truth table16%1/6
A and B and C and D and E
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"C= builtin::blessed($elem)D= $elem->can("get_type")E= $elem->get_type eq "timestamp"
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
579 && $PROTOCOL eq 'rest-xml'
580 && blessed $elem
581 && $elem->can('get_type')
582 && $elem->get_type eq 'timestamp' ) {
583 0 ▶ my $format = $member->{timestampFormat} // $elem->get_timestampFormat // 'iso8601';
Condition0%0/5
($member->{"timestampFormat"} // $elem->get_timestampFormat) // "iso8601"
l!l
00
$member->{"timestampFormat"} // $elem->get_timestampFormat
l!l&&r!l&&!r
000
MC/DC0%0/2
($member->{"timestampFormat"} // $elem->get_timestampFormat) // "iso8601"
$member->{"timestampFormat"} $elem->get_timestampFormat
Truth table0%0/3
A // B
A= $member->{"timestampFormat"}B= $elem->get_timestampFormat
ABresult
1X1
011
000
584  
585 0 $value = _format_timestamp( $elem->get__value, $format, );
586 }
587 else {
588 2 $value = $elem->finalize;
589 }
590  
591 $value = _apply_local_xml_namespace( $value, $member->{xmlNamespace}, )
592 2 ▶ if $PROTOCOL && $PROTOCOL eq 'rest-xml';
Branch: 1 branch
BranchTrueFalseTotal
if $Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" 2 0 2
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
!ll&&!rl&&r
002
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
Truth table33%1/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
ABresult
0X0
100
111
593 2 push @list, $value;
594 }
595  
596 my $is_query_protocol = $PROTOCOL
597 2 ▶ && any { $PROTOCOL eq $_ } qw(query ec2);
Subroutine __ANON__: called CC=1 SCAR=0.6
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL && &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
!ll&&!rl&&r
020
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL && &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
$Amazon::API::Botocore::Shape::PROTOCOL &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
Truth table33%1/3
A && B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= &any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')
ABresult
0X0
100
111
598  
599 2 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2") 0 2 2
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
!ll&&!rl&&r
020
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
Truth table33%1/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
ABresult
0X0
100
111
600 && $PROTOCOL eq 'ec2' ) {
601 return {}
602 0 ▶ if !@list;
Branch: 1 branch
BranchTrueFalseTotal
unless @list 0 0 0
603  
604 0 my %indexed;
605 0 my $idx = 1;
606  
607 0 foreach my $elem (@list) {
608 0 $indexed{ $idx++ } = $elem;
609 }
610  
611 0 return \%indexed;
612 }
613  
614 2 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "query") 0 2 2
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "query"
!ll&&!rl&&r
020
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "query"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "query"
Truth table33%1/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "query"
ABresult
0X0
100
111
615 && $PROTOCOL eq 'query' ) {
616 0 ▶ return q{}
Branch: 1 branch
BranchTrueFalseTotal
unless @list 0 0 0
617 if !@list;
618  
619 0 ▶ my $member_name = $location_name // 'member';
Condition0%0/2
$location_name // "member"
l!l
00
MC/DC0%0/1
$location_name // "member"
$location_name
Truth table0%0/2
A
A= $location_name
Aresult
11
00
620  
621 0 my %indexed;
622 0 my $idx = 1;
623  
624 0 foreach my $elem (@list) {
625 0 $indexed{ $member_name . q{.} . $idx++ } = $elem;
626 }
627  
628 0 return \%indexed;
629 }
630  
631 2 ▶ if ( $PROTOCOL && $PROTOCOL eq 'rest-xml' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml") 2 0 2
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
!ll&&!rl&&r
002
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
Truth table33%1/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
ABresult
0X0
100
111
632 2 ▶ my $member_name = $location_name // 'member';
Condition50%1/2
$location_name // "member"
l!l
20
MC/DC0%0/1
$location_name // "member"
$location_name
Truth table50%1/2
A
A= $location_name
Aresult
11
00
633  
634 2 return { $member_name => \@list, };
635 }
636  
637 0 my $list = \@list;
638  
639 0 my $output;
640  
641 0 ▶ if ($location_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($location_name) { } 0 0 0
642 0 $output = { $location_name => $list, };
643 }
644 else {
645 0 $output = $list;
646 }
647  
648 0 ▶ return flatten($output)
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_flattened 0 0 0
649 if $self->is_flattened;
650  
651 0 return $output;
652 }
653  
654 ########################################################################
655 12 ▶sub _format_timestamp {
Subroutine _format_timestamp: called CC=7 SCAR=19.9
656 ########################################################################
657 12 my ( $value, $format ) = @_;
658  
659 12 ▶ return $value
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 12 12
660 if !defined $value;
661  
662 # canonicalize input to epoch seconds. Accept epoch (int/float) or any
663 # object that can ->epoch (Time::Piece, DateTime) - duck-typed so we never
664 # load DateTime. Bare strings are refused rather than date-parsed (that is
665 # boto's fragile path); pass an epoch or a Time::Piece/DateTime.
666 12 ▶ my $epoch
Branch: 2 branches
BranchTrueFalseTotal
builtin::blessed($value) && $value->can('epoch') ? : 0 12 12
&looks_like_number($value) ? : 11 1 12
Condition33%1/3
builtin::blessed($value) and $value->can("epoch")
!ll&&!rl&&r
1200
MC/DC0%0/2
builtin::blessed($value) and $value->can("epoch")
builtin::blessed($value) $value->can("epoch")
Truth table33%1/3
A and B
A= builtin::blessed($value)B= $value->can("epoch")
ABresult
0X0
100
111
667 = ( blessed $value && $value->can('epoch') ) ? $value->epoch
668 : looks_like_number($value) ? $value
669 : croak "timestamp: expected epoch seconds or a Time::Piece/DateTime, got '$value'\n";
670  
671 11 ▶ return $epoch + 0
Branch: 1 branch
BranchTrueFalseTotal
if $format eq "unixTimestamp" 3 8 11
672 if $format eq 'unixTimestamp';
673  
674 8 my @g = gmtime int $epoch;
675  
676 8 ▶ return sprintf '%04d-%02d-%02dT%02d:%02d:%02dZ', $g[5] + 1900, $g[4] + 1, $g[3], $g[2], $g[1], $g[0]
Branch: 1 branch
BranchTrueFalseTotal
if $format eq "iso8601" 6 2 8
677 if $format eq 'iso8601';
678  
679 # rfc822 - explicit English names (locale-independent), matches boto's
680 # email.utils.formatdate(usegmt=True): "Wed, 17 Jun 2015 22:11:58 GMT"
681 2 my @dow = qw(Sun Mon Tue Wed Thu Fri Sat);
682 2 my @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
683  
684 2 return sprintf '%s, %02d %s %04d %02d:%02d:%02d GMT', $dow[ $g[6] ], $g[3], $mon[ $g[4] ], $g[5] + 1900, $g[2], $g[1], $g[0];
685 }
686  
687 ########################################################################
688 15 ▶sub finalize_structure {
Subroutine finalize_structure: called CC=58 SCAR=61.2
Pod undocumented
689 ########################################################################
690 15 my ($self) = @_;
691  
692 15 my $members = $self->get_members;
693  
694 $self->get_logger->trace(
695 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
696 0 return Dumper(
697 [ sub => 'finalize',
698 members => $members,
699 value => $self->get__value,
700 ]
701 );
702 }
703 15 );
704  
705 15 my $output = {};
706  
707 15 ▶ if ( $PROTOCOL && $PROTOCOL eq 'rest-xml' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml") 11 4 15
Condition66%2/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
!ll&&!rl&&r
0411
MC/DC50%1/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
Truth table66%2/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
ABresult
0X0
100
111
708 11 my $attributes = _xml_namespace_attributes( $self->get_xmlNamespace, );
709  
710 11 ▶ if ($attributes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attributes) 0 11 11
711 0 $output->{_attr} = $attributes;
712 }
713 }
714  
715 15 foreach my $member ( keys %{$members} ) {
716  
717 44 my $member_config = $members->{$member};
718 44 my $member_name;
719  
720 44 ▶ if ( $PROTOCOL
Branch: 2 branches
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq 'ec2') { } 0 44 44
elsif (not $member_config->{'location'}) { } 30 14 44
Condition33%1/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
!ll&&!rl&&r
0440
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
Truth table33%1/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "ec2"
ABresult
0X0
100
111
721 && $PROTOCOL eq 'ec2' ) {
722 0 ▶ if ( defined $member_config->{queryName} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $member_config->{'queryName'}) { } 0 0 0
elsif (defined $member_config->{'locationName'}) { } 0 0 0
723 0 $member_name = $member_config->{queryName};
724 }
725 elsif ( defined $member_config->{locationName} ) {
726 0 $member_name = ucfirst $member_config->{locationName};
727 }
728 else {
729 0 $member_name = ucfirst $member;
730 }
731 }
732 elsif ( !$member_config->{location} ) {
733 30 ▶ $member_name = $member_config->{locationName} // $member;
Condition66%2/3
$member_config->{"locationName"} // $member
l!l&&r!l&&!r
2280
MC/DC0%0/2
$member_config->{"locationName"} // $member
$member_config->{"locationName"} $member
Truth table66%2/3
A // B
A= $member_config->{"locationName"}B= $member
ABresult
1X1
011
000
734 }
735 else {
736 14 $member_name = $member;
737 }
738  
739 44 my $value = $self->get__value->{$member};
740  
741 next
742 44 ▶ if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 14 30 44
743  
744 30 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "json", "rest-json") and builtin::blessed($value) and $value->can("get__value") and not defined $value->get__value) 0 30 30
Condition66%8/12
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "json", "rest-json") and builtin::blessed($value) and $value->can("get__value") and not defined $value->get__value
!ll&&!rl&&r
2550
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "json", "rest-json") and builtin::blessed($value) and $value->can("get__value")
!ll&&!rl&&r
2505
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "json", "rest-json") and builtin::blessed($value)
!ll&&!rl&&r
2505
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "json", "rest-json")
!ll&&!rl&&r
0255
MC/DC0%0/5
$Amazon::API::Botocore::Shape::PROTOCOL and &any(sub { $PROTOCOL eq $_; } , "json", "rest-json") and builtin::blessed($value) and $value->can("get__value") and not defined $value->get__value
$Amazon::API::Botocore::Shape::PROTOCOL &any(sub { $PROTOCOL eq $_; } , "json", "rest-json") builtin::blessed($value) $value->can("get__value") not defined $value->get__value
Truth table33%2/6
A and B and C and D and not(E)
A= $Amazon::API::Botocore::Shape::PROTOCOLB= &any(sub { $PROTOCOL eq $_; } , "json", "rest-json")C= builtin::blessed($value)D= $value->can("get__value")E= not defined $value->get__value
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
745 55 ▶ && ( any { $PROTOCOL eq $_ } qw(json rest-json) )
Subroutine __ANON__: called CC=1 SCAR=0.0
746 && blessed $value
747 && $value->can('get__value')
748 && !defined $value->get__value ) {
749 0 next;
750 }
751  
752 30 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and $members->{$member}{"xmlAttribute"}) 0 30 30
Condition66%4/6
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and $members->{$member}{"xmlAttribute"}
!ll&&!rl&&r
7230
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
!ll&&!rl&&r
0723
MC/DC0%0/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" and $members->{$member}{"xmlAttribute"}
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml" $members->{$member}{"xmlAttribute"}
Truth table50%2/4
A and B and C
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"C= $members->{$member}{"xmlAttribute"}
ABCresult
0XX0
10X0
1100
1111
753 && $PROTOCOL eq 'rest-xml'
754 && $members->{$member}->{xmlAttribute} ) {
755 0 ▶ my $attribute_value
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($value) && $value->can('finalize') ? : 0 0 0
Condition0%0/3
builtin::blessed($value) and $value->can("finalize")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($value) and $value->can("finalize")
builtin::blessed($value) $value->can("finalize")
Truth table0%0/3
A and B
A= builtin::blessed($value)B= $value->can("finalize")
ABresult
0X0
100
111
756 = blessed $value && $value->can('finalize')
757 ? $value->finalize
758 : $value;
759  
760 0 $output->{_attr}->{$member_name} = $attribute_value;
761  
762 0 next;
763 }
764  
765 30 ▶ if ( blessed $value
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($value) and $value->can('get_type') and $value->get_type eq 'timestamp') { } 12 18 30
Condition50%3/6
builtin::blessed($value) and $value->can("get_type") and $value->get_type eq "timestamp"
!ll&&!rl&&r
01812
builtin::blessed($value) and $value->can("get_type")
!ll&&!rl&&r
0030
MC/DC33%1/3
builtin::blessed($value) and $value->can("get_type") and $value->get_type eq "timestamp"
builtin::blessed($value) $value->can("get_type") $value->get_type eq "timestamp"
Truth table50%2/4
A and B and C
A= builtin::blessed($value)B= $value->can("get_type")C= $value->get_type eq "timestamp"
ABCresult
0XX0
10X0
1100
1111
766 && $value->can('get_type')
767 && $value->get_type eq 'timestamp' ) {
768 # resolve the effective wire format, most-specific first:
769 # member timestampFormat -> shape timestampFormat -> location default
770 # (header=>rfc822, querystring=>iso8601) -> protocol body default
771 # (json/rest-json=>unixTimestamp, else iso8601).
772 12 ▶ my $location = $members->{$member}->{location} // $EMPTY;
Condition66%2/3
$members->{$member}{"location"} // $Amazon::API::Botocore::Shape::EMPTY
l!l&&r!l&&!r
390
MC/DC0%0/2
$members->{$member}{"location"} // $Amazon::API::Botocore::Shape::EMPTY
$members->{$member}{"location"} $Amazon::API::Botocore::Shape::EMPTY
Truth table66%2/3
A // B
A= $members->{$member}{"location"}B= $Amazon::API::Botocore::Shape::EMPTY
ABresult
1X1
011
000
773  
774 12 ▶ my $format = $members->{$member}->{timestampFormat} // $value->get_timestampFormat // (
Branch: 3 branches
BranchTrueFalseTotal
$location eq 'header' ? : 2 6 8
$location eq 'querystring' ? : 1 5 6
($Amazon::API::Botocore::Shape::PROTOCOL // $Amazon::API::Botocore::Shape::EMPTY) =~ /json/msx ? : 2 3 5
Condition62%5/8
($members->{$member}{"timestampFormat"} // $value->get_timestampFormat) // ($location eq "header" ? "rfc822" : ($location eq "querystring" ? "iso8601" : (($Amazon::API::Botocore::Shape::PROTOCOL // $Amazon::API::Botocore::Shape::EMPTY) =~ /json/msx ? "unixTimestamp" : "iso8601")))
l!l
48
$members->{$member}{"timestampFormat"} // $value->get_timestampFormat
l!l&&r!l&&!r
048
$Amazon::API::Botocore::Shape::PROTOCOL // $Amazon::API::Botocore::Shape::EMPTY
l!l&&r!l&&!r
500
MC/DC50%1/2
($members->{$member}{"timestampFormat"} // $value->get_timestampFormat) // ($location eq "header" ? "rfc822" : ($location eq "querystring" ? "iso8601" : (($Amazon::API::Botocore::Shape::PROTOCOL // $Amazon::API::Botocore::Shape::EMPTY) =~ /json/msx ? "unixTimestamp" : "iso8601")))
$members->{$member}{"timestampFormat"} $value->get_timestampFormat
MC/DC0%0/2
$Amazon::API::Botocore::Shape::PROTOCOL // $Amazon::API::Botocore::Shape::EMPTY
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::EMPTY
Truth table66%2/3
A // B
A= $members->{$member}{"timestampFormat"}B= $value->get_timestampFormat
ABresult
1X1
011
000
Truth table33%1/3
A // B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::EMPTY
ABresult
1X1
011
000
775 $location eq 'header' ? 'rfc822'
776 : $location eq 'querystring' ? 'iso8601'
777 : ( $PROTOCOL // $EMPTY ) =~ /json/xsm ? 'unixTimestamp'
778 : 'iso8601'
779 );
780  
781 12 $output->{$member_name} = _format_timestamp( $value->get__value, $format, );
782 }
783 else {
784 18 my $finalized;
785  
786 # A blob used as the HTTP payload is the body itself. Do not
787 # base64-encode it as we do for ordinary modeled blob members.
788 18 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx and ($self->{'payload'} // $Amazon::API::Botocore::Shape::EMPTY) eq $member and builtin::blessed($value) and $value->can('get_type') and $value->get_type eq 'blob') { } 0 18 18
Condition72%13/18
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx and ($self->{"payload"} // $Amazon::API::Botocore::Shape::EMPTY) eq $member and builtin::blessed($value) and $value->can("get_type") and $value->get_type eq "blob"
!ll&&!rl&&r
1620
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx and ($self->{"payload"} // $Amazon::API::Botocore::Shape::EMPTY) eq $member and builtin::blessed($value) and $value->can("get_type")
!ll&&!rl&&r
1602
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx and ($self->{"payload"} // $Amazon::API::Botocore::Shape::EMPTY) eq $member and builtin::blessed($value)
!ll&&!rl&&r
1602
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx and ($self->{"payload"} // $Amazon::API::Botocore::Shape::EMPTY) eq $member
!ll&&!rl&&r
2142
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx
!ll&&!rl&&r
0216
$self->{"payload"} // $Amazon::API::Botocore::Shape::EMPTY
l!l&&r!l&&!r
5110
MC/DC0%0/7
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx and ($self->{"payload"} // $Amazon::API::Botocore::Shape::EMPTY) eq $member and builtin::blessed($value) and $value->can("get_type") and $value->get_type eq "blob"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msx $self->{"payload"} $Amazon::API::Botocore::Shape::EMPTY builtin::blessed($value) $value->can("get_type") $value->get_type eq "blob"
Truth table18%2/11
A and B and C // D and E and F and G
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL =~ /^rest\-(?:xml|json)$/msxC= $self->{"payload"}D= $Amazon::API::Botocore::Shape::EMPTYE= builtin::blessed($value)F= $value->can("get_type")G= $value->get_type eq "blob"
ABCDEFGresult
0XXXXXX0
10XXXXX0
1100XXX0
111X0XX0
11010XX0
111X10X0
110110X0
111X1100
11011100
111X1111
11011111
789 && $PROTOCOL =~ /^rest\-(?:xml|json)$/xsm
790 && ( $self->{payload} // $EMPTY ) eq $member
791 && blessed $value
792 && $value->can('get_type')
793 && $value->get_type eq 'blob' ) {
794 0 $finalized = $value->get__value;
795 }
796 else {
797 18 ▶ $finalized
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($value) && $value->can('finalize') ? : 18 0 18
Condition33%1/3
builtin::blessed($value) and $value->can("finalize")
!ll&&!rl&&r
0018
MC/DC0%0/2
builtin::blessed($value) and $value->can("finalize")
builtin::blessed($value) $value->can("finalize")
Truth table33%1/3
A and B
A= builtin::blessed($value)B= $value->can("finalize")
ABresult
0X0
100
111
798 = blessed $value && $value->can('finalize')
799 ? $value->finalize
800 : $value;
801 }
802  
803 18 ▶ if ( $members->{$member}->{flattened}
Branch: 1 branch
BranchTrueFalseTotal
if ($members->{$member}{"flattened"} and $Amazon::API::Botocore::Shape::PROTOCOL and builtin::blessed($value) and $value->can("get_type")) 0 18 18
Condition33%3/9
$members->{$member}{"flattened"} and $Amazon::API::Botocore::Shape::PROTOCOL and builtin::blessed($value) and $value->can("get_type")
!ll&&!rl&&r
1800
$members->{$member}{"flattened"} and $Amazon::API::Botocore::Shape::PROTOCOL and builtin::blessed($value)
!ll&&!rl&&r
1800
$members->{$member}{"flattened"} and $Amazon::API::Botocore::Shape::PROTOCOL
!ll&&!rl&&r
1800
MC/DC0%0/4
$members->{$member}{"flattened"} and $Amazon::API::Botocore::Shape::PROTOCOL and builtin::blessed($value) and $value->can("get_type")
$members->{$member}{"flattened"} $Amazon::API::Botocore::Shape::PROTOCOL builtin::blessed($value) $value->can("get_type")
Truth table20%1/5
A and B and C and D
A= $members->{$member}{"flattened"}B= $Amazon::API::Botocore::Shape::PROTOCOLC= builtin::blessed($value)D= $value->can("get_type")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
804 && $PROTOCOL
805 && blessed($value)
806 && $value->can('get_type') ) {
807  
808 0 ▶ if ( any { $PROTOCOL eq $_ } qw(query ec2) ) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 2 branches
BranchTrueFalseTotal
if (&any(sub { $PROTOCOL eq $_; } , 'query', 'ec2')) { } 0 0 0
elsif ($Amazon::API::Botocore::Shape::PROTOCOL eq 'rest-xml') { } 0 0 0
809 0 ▶ if ( $value->get_type eq 'list' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($value->get_type eq 'list') { } 0 0 0
elsif ($value->get_type eq 'map') { } 0 0 0
810 0 my %indexed;
811  
812 0 foreach my $key ( keys %{$finalized} ) {
813 0 my ($idx) = $key =~ /\.(\d+)$/xsm;
814  
815 next
816 0 ▶ if !defined $idx;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $idx 0 0 0
817  
818 0 $indexed{$idx} = $finalized->{$key};
819 }
820  
821 0 $finalized = \%indexed;
822 }
823 elsif ( $value->get_type eq 'map' ) {
824 0 my %indexed;
825  
826 0 foreach my $key ( keys %{$finalized} ) {
827 0 my ($idx) = $key =~ /^entry\.(\d+)$/xsm;
828  
829 next
830 0 ▶ if !defined $idx;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $idx 0 0 0
831  
832 0 $indexed{$idx} = $finalized->{$key};
833 }
834  
835 0 $finalized = \%indexed;
836 }
837 }
838 elsif ( $PROTOCOL eq 'rest-xml' ) {
839 0 ▶ if ( $value->get_type eq 'list' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($value->get_type eq 'list') { } 0 0 0
elsif ($value->get_type eq 'map') { } 0 0 0
840 0 ▶ my $member_name = $value->get_member->{locationName} // 'member';
Condition0%0/2
$value->get_member->{"locationName"} // "member"
l!l
00
MC/DC0%0/1
$value->get_member->{"locationName"} // "member"
$value->get_member->{"locationName"}
Truth table0%0/2
A
A= $value->get_member->{"locationName"}
Aresult
11
00
841  
842 0 $finalized = $finalized->{$member_name};
843 }
844 elsif ( $value->get_type eq 'map' ) {
845 0 $finalized = $finalized->{entry};
846 }
847 }
848  
849 }
850  
851 18 my $namespace = $members->{$member}->{xmlNamespace};
852  
853 18 ▶ if ( $PROTOCOL
Branch: 1 branch
BranchTrueFalseTotal
if ($Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml") 16 2 18
Condition66%2/3
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
!ll&&!rl&&r
0216
MC/DC50%1/2
$Amazon::API::Botocore::Shape::PROTOCOL and $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
$Amazon::API::Botocore::Shape::PROTOCOL $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
Truth table66%2/3
A and B
A= $Amazon::API::Botocore::Shape::PROTOCOLB= $Amazon::API::Botocore::Shape::PROTOCOL eq "rest-xml"
ABresult
0X0
100
111
854 && $PROTOCOL eq 'rest-xml' ) {
855 16 $finalized = _apply_local_xml_namespace( $finalized, $namespace, );
856 }
857  
858 18 $output->{$member_name} = $finalized;
859 }
860 }
861  
862 14 return $output;
863 }
864  
865 ########################################################################
866 11 ▶sub _xml_namespace_attributes {
Subroutine _xml_namespace_attributes: called CC=7 SCAR=36.8
867 ########################################################################
868 11 my ($namespace) = @_;
869  
870 return
871 11 ▶ if !$namespace;
Branch: 1 branch
BranchTrueFalseTotal
unless $namespace 11 0 11
872  
873 0 my ( $uri, $prefix );
874  
875 0 ▶ if ( ref $namespace
Branch: 1 branch
BranchTrueFalseTotal
if (ref $namespace and builtin::reftype($namespace) eq 'HASH') { } 0 0 0
Condition0%0/3
ref $namespace and builtin::reftype($namespace) eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $namespace and builtin::reftype($namespace) eq "HASH"
ref $namespace builtin::reftype($namespace) eq "HASH"
Truth table0%0/3
A and B
A= ref $namespaceB= builtin::reftype($namespace) eq "HASH"
ABresult
0X0
100
111
876 && reftype($namespace) eq 'HASH' ) {
877 0 $uri = $namespace->{uri};
878 0 $prefix = $namespace->{prefix};
879 }
880 else {
881 0 $uri = $namespace;
882 }
883  
884 return
885 0 ▶ if !defined $uri
Branch: 1 branch
BranchTrueFalseTotal
if not defined $uri or $uri eq $Amazon::API::Botocore::Shape::EMPTY 0 0 0
Condition0%0/3
not defined $uri or $uri eq $Amazon::API::Botocore::Shape::EMPTY
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $uri or $uri eq $Amazon::API::Botocore::Shape::EMPTY
not defined $uri $uri eq $Amazon::API::Botocore::Shape::EMPTY
Truth table0%0/3
not(A) or B
A= not defined $uriB= $uri eq $Amazon::API::Botocore::Shape::EMPTY
ABresult
1X1
011
000
886 || $uri eq $EMPTY;
887  
888 0 ▶ my $attribute
Branch: 1 branch
BranchTrueFalseTotal
$prefix ? : 0 0 0
889 = $prefix
890 ? sprintf 'xmlns:%s', $prefix
891 : 'xmlns';
892  
893 0 return { $attribute => $uri, };
894 }
895  
896 ########################################################################
897 18 ▶sub _apply_local_xml_namespace {
Subroutine _apply_local_xml_namespace: called CC=5 SCAR=18.1
898 ########################################################################
899 18 my ( $value, $namespace ) = @_;
900  
901 18 ▶ return $value
Branch: 1 branch
BranchTrueFalseTotal
unless defined $namespace 15 3 18
902 if !defined $namespace;
903  
904 3 ▶ if ( ref $namespace
Branch: 1 branch
BranchTrueFalseTotal
if (ref $namespace and builtin::reftype($namespace) eq "HASH") 3 0 3
Condition33%1/3
ref $namespace and builtin::reftype($namespace) eq "HASH"
!ll&&!rl&&r
003
MC/DC0%0/2
ref $namespace and builtin::reftype($namespace) eq "HASH"
ref $namespace builtin::reftype($namespace) eq "HASH"
Truth table33%1/3
A and B
A= ref $namespaceB= builtin::reftype($namespace) eq "HASH"
ABresult
0X0
100
111
905 && reftype($namespace) eq 'HASH' ) {
906 return $value
907 3 ▶ if !$namespace->{prefix};
Branch: 1 branch
BranchTrueFalseTotal
unless $namespace->{"prefix"} 3 0 3
908 }
909  
910 0 return _apply_xml_namespace( $value, $namespace, );
911 }
912  
913 ########################################################################
914 0 ▶sub _apply_xml_namespace {
Subroutine _apply_xml_namespace: not called CC=5 SCAR=34.0
915 ########################################################################
916 0 my ( $value, $namespace ) = @_;
917  
918 0 my $attributes = _xml_namespace_attributes($namespace);
919  
920 0 ▶ return $value
Branch: 1 branch
BranchTrueFalseTotal
unless $attributes 0 0 0
921 if !$attributes;
922  
923 0 ▶ if ( ref $value
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value and builtin::reftype($value) eq "HASH") 0 0 0
Condition0%0/3
ref $value and builtin::reftype($value) eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $value and builtin::reftype($value) eq "HASH"
ref $value builtin::reftype($value) eq "HASH"
Truth table0%0/3
A and B
A= ref $valueB= builtin::reftype($value) eq "HASH"
ABresult
0X0
100
111
924 && reftype($value) eq 'HASH' ) {
925 0 ▶ $value->{_attr} //= {};
Condition0%0/2
$value->{"_attr"} //= {}
l!l
00
MC/DC0%0/1
$value->{"_attr"} //= {}
$value->{"_attr"}
Truth table0%0/2
A
A= $value->{"_attr"}
Aresult
11
00
926  
927 0 @{ $value->{_attr} }{ keys %{$attributes} }
928 0 = values %{$attributes};
929  
930 0 return $value;
931 }
932  
933 return {
934 0 _attr => $attributes,
935 _text => $value,
936 };
937 }
938  
939 14 1;
940  
« API/Botocore/Shape/Serializer.pm ↑ Summary API/Error.pm »