lib/Amazon/DynamoDB/20120810.pm

filter: Statementstmt 30.1% 505 / 1677 Branchbran 0.0% 0 / 924 Conditioncond 0.0% 0 / 338 MC/DCmcdc 0.0% 0 / 183 Subroutinesub 70.9% 159 / 224 Podpod 100% 11 / 11 totaltotal 20.1% 675 / 3357 CC 628 SCAR 67.3
CC
628
Cov
17%
query
3555.0
scan
2231.8
update_item
2189.1
CRAP 841.1
↑ Summary lib/Amazon/DynamoDB.pm »
1 package Amazon::DynamoDB::20120810;
2 11 $Amazon::DynamoDB::20120810::VERSION = '0.35';
3 11 ▶use strict;
Subroutine __ANON__: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine __ANON__: called CC=1 SCAR=0.0
5  
6  
7 11 ▶use Future;
Subroutine __ANON__: called CC=1 SCAR=0.0
8 11 ▶use Future::Utils qw(repeat try_repeat);
Subroutine __ANON__: called CC=1 SCAR=0.0
9 11 ▶use POSIX qw(strftime);
Subroutine __ANON__: called CC=1 SCAR=0.0
10 11 ▶use JSON::MaybeXS qw(decode_json encode_json);
Subroutine __ANON__: called CC=1 SCAR=0.0
11 11 ▶use MIME::Base64;
Subroutine __ANON__: called CC=1 SCAR=0.0
12 11 ▶use List::Util;
Subroutine __ANON__: called CC=1 SCAR=0.0
13 11 ▶use List::MoreUtils;
Subroutine __ANON__: called CC=1 SCAR=0.0
14 11 ▶use B qw(svref_2object);
Subroutine __ANON__: called CC=1 SCAR=0.0
15 11 ▶use HTTP::Request;
Subroutine __ANON__: called CC=1 SCAR=0.0
16 11 ▶use Kavorka;
Subroutine __ANON__: called CC=1 SCAR=0.0
17 11 ▶use Amazon::DynamoDB::Types;
Subroutine __ANON__: called CC=1 SCAR=0.0
18 11 ▶use Type::Registry;
Subroutine __ANON__: called CC=1 SCAR=0.0
19 11 ▶use VM::EC2::Security::CredentialCache;
Subroutine __ANON__: called CC=1 SCAR=0.0
20 11 ▶use AWS::Signature4;
Subroutine __ANON__: called CC=1 SCAR=0.0
21
22 11 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
23 11 my $reg = "Type::Registry"->for_me;
24 11 $reg->add_types(-Standard);
25 11 $reg->add_types("Amazon::DynamoDB::Types");
26 };
27  
28  
29  
30 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
31 0 my $class = shift;
32 0 bless { @_ }, $class
33 }
34  
35 0 ▶sub implementation { shift->{implementation} }
Subroutine implementation: not called CC=1 SCAR=6.9
Pod documented
36 0 ▶sub host { shift->{host} }
Subroutine host: not called CC=1 SCAR=6.9
Pod documented
37 0 ▶sub port { shift->{port} }
Subroutine port: not called CC=1 SCAR=6.9
Pod documented
38 0 ▶sub ssl { shift->{ssl} }
Subroutine ssl: not called CC=1 SCAR=6.9
Pod documented
39 0 ▶sub algorithm { 'AWS4-HMAC-SHA256' }
Subroutine algorithm: not called CC=1 SCAR=6.9
Pod documented
40 0 ▶sub scope { shift->{scope} }
Subroutine scope: not called CC=1 SCAR=6.9
Pod documented
41 0 ▶sub access_key { shift->{access_key} }
Subroutine access_key: not called CC=1 SCAR=6.9
Pod documented
42 0 ▶sub secret_key { shift->{secret_key} }
Subroutine secret_key: not called CC=1 SCAR=6.9
Pod documented
43 0 ▶sub debug_failures { shift->{debug} }
Subroutine debug_failures: not called CC=1 SCAR=6.9
Pod documented
44  
45 0 ▶sub max_retries { shift->{max_retries} }
Subroutine max_retries: not called CC=1 SCAR=6.9
Pod documented
46  
47  
48  
49  
50  
51 method create_table(TableNameType :$TableName!,
52 Int :$ReadCapacityUnits = 2,
53 Int :$WriteCapacityUnits = 2,
54 AttributeDefinitionsType :$AttributeDefinitions,
55 KeySchemaType :$KeySchema!,
56 ArrayRef[GlobalSecondaryIndexType] :$GlobalSecondaryIndexes where { scalar(@$_) <= 5 },
57 ArrayRef[LocalSecondaryIndexType] :$LocalSecondaryIndexes
58 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine create_table: not called CC=36 SCAR=67.5
Branch: 21 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReadCapacityUnits'} ? : 0 0 0
Type::Tiny::XS::Int($ReadCapacityUnits) or _failed_check(18, "Int", $ReadCapacityUnits, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'WriteCapacityUnits'} ? : 0 0 0
Type::Tiny::XS::Int($WriteCapacityUnits) or _failed_check(18, "Int", $WriteCapacityUnits, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'AttributeDefinitions'} ? : 0 0 0
if (exists $_{"AttributeDefinitions"}) 0 0 0
exists $_{'KeySchema'} ? : 0 0 0
if (exists $_{"KeySchema"}) 0 0 0
exists $_{'GlobalSecondaryIndexes'} ? : 0 0 0
if (exists $_{"GlobalSecondaryIndexes"}) 0 0 0
do { local $_ = $GlobalSecondaryIndexes; $Kavorka::Parameter::PARAMS[5]{"constraints"}[0]->() } or Carp::croak("\$GlobalSecondaryIndexes failed value constraint") 0 0 0
exists $_{'LocalSecondaryIndexes'} ? : 0 0 0
if (exists $_{"LocalSecondaryIndexes"}) 0 0 0
Condition0%0/9
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
59 0 my %payload = (
60 TableName => $TableName,
61 ProvisionedThroughput => {
62 ReadCapacityUnits => int($ReadCapacityUnits),
63 WriteCapacityUnits => int($WriteCapacityUnits),
64 }
65 );
66  
67 0 ▶ if (defined($AttributeDefinitions)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $AttributeDefinitions) 0 0 0
68 0 foreach my $field_name (keys %$AttributeDefinitions) {
69 0 my $type = $AttributeDefinitions->{$field_name};
70  
71 0 ▶ push @{$payload{AttributeDefinitions}}, {
Condition0%0/2
$type // "S"
l!l
00
MC/DC0%0/1
$type // "S"
$type
Truth table0%0/2
A
A= $type
Aresult
11
00
72 AttributeName => $field_name,
73 AttributeType => $type // 'S',
74 }
75 }
76 }
77  
78 0 $payload{KeySchema} = _create_key_schema($KeySchema, $AttributeDefinitions);
79  
80 0 foreach my $index_record (['GlobalSecondaryIndexes', $GlobalSecondaryIndexes],
81 ['LocalSecondaryIndexes', $LocalSecondaryIndexes]) {
82 0 my $index_type = $index_record->[0];
83 0 my $index = $index_record->[1];
84
85 0 ▶ if (defined($index)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $index) 0 0 0
86 0 foreach my $i (@$index) {
87 my $r = {
88 IndexName => $i->{IndexName},
89 (($index_type eq 'GlobalSecondaryIndexes') ?
90 (ProvisionedThroughput => {
91 ReadCapacityUnits => int($i->{ProvisionedThroughput}->{ReadCapacityUnits} // 1),
92 WriteCapacityUnits => int($i->{ProvisionedThroughput}->{WriteCapacityUnits} // 1),
93 }) : ()),
94 0 ▶ KeySchema => _create_key_schema($i->{KeySchema}, $AttributeDefinitions),
Branch: 1 branch
BranchTrueFalseTotal
$index_type eq 'GlobalSecondaryIndexes' ? : 0 0 0
Condition0%0/4
$i->{"ProvisionedThroughput"}{"ReadCapacityUnits"} // 1
l!l
00
$i->{"ProvisionedThroughput"}{"WriteCapacityUnits"} // 1
l!l
00
MC/DC0%0/1
$i->{"ProvisionedThroughput"}{"ReadCapacityUnits"} // 1
$i->{"ProvisionedThroughput"}{"ReadCapacityUnits"}
MC/DC0%0/1
$i->{"ProvisionedThroughput"}{"WriteCapacityUnits"} // 1
$i->{"ProvisionedThroughput"}{"WriteCapacityUnits"}
Truth table0%0/2
A
A= $i->{"ProvisionedThroughput"}{"ReadCapacityUnits"}
Aresult
11
00
Truth table0%0/2
A
A= $i->{"ProvisionedThroughput"}{"WriteCapacityUnits"}
Aresult
11
00
95 };
96  
97 0 my $type = $i->{Projection}->{ProjectionType};
98 0 $r->{Projection}->{ProjectionType} = $type;
99
100 0 ▶ if (defined($i->{Projection}->{NonKeyAttributes})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $i->{"Projection"}{"NonKeyAttributes"}) 0 0 0
101 0 my $attrs = $i->{Projection}->{NonKeyAttributes};
102 # Can't validate these attribute names since they aren't part of the key.
103 0 $r->{Projection}->{NonKeyAttributes} = $attrs;
104 }
105 0 push @{$payload{$index_type}}, $r;
106 }
107 }
108 }
109  
110 0 my $req = $self->make_request(
111 target => 'CreateTable',
112 payload => \%payload,
113 );
114 0 $self->_process_request($req)
115 }
116  
117  
118 0 ▶method describe_table(TableNameType :$TableName!) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine describe_table: not called CC=13 SCAR=44.8
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/9
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
119 0 my $req = $self->make_request(
120 target => 'DescribeTable',
121 payload => _make_payload({
122 TableName => $TableName
123 }));
124 $self->_process_request($req,
125 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
126 0 my $content = shift;
127 0 decode_json($content)->{Table};
128 0 });
129 }
130  
131  
132 0 ▶method delete_table(TableNameType :$TableName!) {
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine BEGIN: called CC=1 SCAR=3.5
Subroutine delete_table: not called CC=13 SCAR=44.8
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/9
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
133 0 my $req = $self->make_request(
134 target => 'DeleteTable',
135 payload => _make_payload({ TableName => $TableName }));
136 $self->_process_request($req,
137 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
138 0 my $content = shift;
139 decode_json($content)->{TableDescription}
140 0 });
141 }
142  
143  
144 method wait_for_table_status(TableNameType :$TableName!,
145 Int :$WaitInterval = 2,
146 0 ▶ TableStatusType :$DesiredStatus = "ACTIVE") {
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine BEGIN: called CC=1 SCAR=3.6
Subroutine wait_for_table_status: not called CC=19 SCAR=52.6
Branch: 12 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'WaitInterval'} ? : 0 0 0
Type::Tiny::XS::Int($WaitInterval) or _failed_check(18, "Int", $WaitInterval, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'DesiredStatus'} ? : 0 0 0
defined $DesiredStatus and not ref $DesiredStatus and not !($DesiredStatus =~ qr/(?^:^(CREATING|UPDATING|DELETING|ACTIVE)$)/) or _failed_check(98, "TableStatusType", $DesiredStatus, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/15
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
defined $DesiredStatus and not ref $DesiredStatus and not !($DesiredStatus =~ qr/(?^:^(CREATING|UPDATING|DELETING|ACTIVE)$)/)
!ll&&!rl&&r
000
defined $DesiredStatus and not ref $DesiredStatus
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
MC/DC0%0/3
defined $DesiredStatus and not ref $DesiredStatus and not !($DesiredStatus =~ qr/(?^:^(CREATING|UPDATING|DELETING|ACTIVE)$)/)
defined $DesiredStatus not ref $DesiredStatus not !($DesiredStatus =~ qr/(?^:^(CREATING|UPDATING|DELETING|ACTIVE)$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $DesiredStatusB= not ref $DesiredStatusC= not !($DesiredStatus =~ qr/(?^:^(CREATING|UPDATING|DELETING|ACTIVE)$)/)
ABCresult
0XX0
10X0
1100
1111
147 0 ▶ repeat {
Subroutine __ANON__: not called CC=2 SCAR=17.9
148 0 my $retry = shift;
149
150 $self->{implementation}->delay($retry ? $WaitInterval : 0)
151 0 ▶ ->then(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
152 0 $self->describe_table(TableName => $TableName)
153 0 ▶ });
Branch: 1 branch
BranchTrueFalseTotal
$retry ? : 0 0 0
154 0 ▶ } until => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
155 0 my $f = shift;
156 0 my $status = $f->get->{TableStatus};
157 0 $status eq $DesiredStatus
158 0 };
159 }
160  
161  
162 method each_table(CodeRef $code,
163 TableNameType :$ExclusiveStartTableName,
164 Int :$Limit where { $_ >= 0 && $_ <= 100}
165 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine BEGIN: called CC=1 SCAR=3.9
Subroutine each_table: not called CC=21 SCAR=55.4
Branch: 16 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Ref::Util::XS::is_plain_coderef($code) or _failed_check(22, "CodeRef", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
if ($#_ == 1 and ref $_[1] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'ExclusiveStartTableName'} ? : 0 0 0
if (exists $_{"ExclusiveStartTableName"}) 0 0 0
do { defined $ExclusiveStartTableName and not ref $ExclusiveStartTableName and not !($ExclusiveStartTableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $ExclusiveStartTableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'Limit'} ? : 0 0 0
if (exists $_{"Limit"}) 0 0 0
Type::Tiny::XS::Int($Limit) or _failed_check(18, "Int", $Limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $Limit; $Kavorka::Parameter::PARAMS[18]{"constraints"}[0]->() } or Carp::croak("\$Limit failed value constraint") 0 0 0
Condition0%0/9
$#_ == 1 and ref $_[1] eq "HASH"
!ll&&!rl&&r
000
defined $ExclusiveStartTableName && !ref($ExclusiveStartTableName) && !!($ExclusiveStartTableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $ExclusiveStartTableName and not ref $ExclusiveStartTableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 1 and ref $_[1] eq "HASH"
$#_ == 1 ref $_[1] eq "HASH"
MC/DC0%0/3
defined $ExclusiveStartTableName && !ref($ExclusiveStartTableName) && !!($ExclusiveStartTableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $ExclusiveStartTableName not ref $ExclusiveStartTableName !!($ExclusiveStartTableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 1B= ref $_[1] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) && C
A= defined $ExclusiveStartTableNameB= not ref $ExclusiveStartTableNameC= !!($ExclusiveStartTableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
166 0 my $finished = 0;
167 0 ▶ try_repeat {
Subroutine __ANON__: not called CC=1 SCAR=6.9
168 0 my $req = $self->make_request(
169 target => 'ListTables',
170 payload => _make_payload({
171 ExclusiveStartTableName => $ExclusiveStartTableName,
172 Limit => $Limit
173 }));
174 $self->_process_request($req,
175 0 ▶ sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
176 0 my $result = shift;
177 0 my $data = decode_json($result);
178 0 for my $tbl (@{$data->{TableNames}}) {
179 0 $code->($tbl);
180 }
181 0 $ExclusiveStartTableName = $data->{LastEvaluatedTableName};
182 0 ▶ if (!defined($ExclusiveStartTableName)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $ExclusiveStartTableName) 0 0 0
183 0 $finished = 1
184 }
185 0 });
186 0 ▶ } while => sub { !$finished };
Subroutine __ANON__: not called CC=1 SCAR=6.9
187 }
188  
189  
190 method put_item (ConditionalOperatorType :$ConditionalOperator,
191 Str :$ConditionExpression,
192 ItemType :$Item!,
193 ExpectedType :$Expected,
194 ExpressionAttributeValuesType :$ExpressionAttributeValues,
195 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
196 ReturnItemCollectionMetricsType :$ReturnItemCollectionMetrics,
197 ReturnValuesType :$ReturnValues,
198 0 ▶ TableNameType :$TableName!) {
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine BEGIN: called CC=1 SCAR=4.5
Subroutine put_item: not called CC=42 SCAR=69.5
Branch: 29 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'ConditionalOperator'} ? : 0 0 0
if (exists $_{"ConditionalOperator"}) 0 0 0
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/) or _failed_check(69, "ConditionalOperatorType", $ConditionalOperator, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ConditionExpression'} ? : 0 0 0
if (exists $_{"ConditionExpression"}) 0 0 0
Type::Tiny::XS::Str($ConditionExpression) or _failed_check(14, "Str", $ConditionExpression, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'Item'} ? : 0 0 0
if (exists $_{"Item"}) 0 0 0
exists $_{'Expected'} ? : 0 0 0
if (exists $_{"Expected"}) 0 0 0
exists $_{'ExpressionAttributeValues'} ? : 0 0 0
if (exists $_{"ExpressionAttributeValues"}) 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnItemCollectionMetrics'} ? : 0 0 0
if (exists $_{"ReturnItemCollectionMetrics"}) 0 0 0
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/) or _failed_check(63, "ReturnItemCollectionMetricsType", $ReturnItemCollectionMetrics, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnValues'} ? : 0 0 0
if (exists $_{"ReturnValues"}) 0 0 0
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/) or _failed_check(60, "ReturnValuesType", $ReturnValues, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/33
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics
!ll&&!rl&&r
000
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
!ll&&!rl&&r
000
defined $ReturnValues and not ref $ReturnValues
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
defined $ConditionalOperator not ref $ConditionalOperator not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
defined $ReturnItemCollectionMetrics not ref $ReturnItemCollectionMetrics not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
MC/DC0%0/3
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
defined $ReturnValues not ref $ReturnValues not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ConditionalOperatorB= not ref $ConditionalOperatorC= not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnItemCollectionMetricsB= not ref $ReturnItemCollectionMetricsC= not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnValuesB= not ref $ReturnValuesC= not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
199 0 my $req = $self->make_request(
200 target => 'PutItem',
201 payload => _make_payload({
202 'ConditionalOperator' => $ConditionalOperator,
203 'Expected' => $Expected,
204 'ConditionExpression' => $ConditionExpression,
205 'ExpressionAttributeValues' => $ExpressionAttributeValues,
206 'Item' => $Item,
207 'ReturnConsumedCapacity' => $ReturnConsumedCapacity,
208 'ReturnItemCollectionMetrics' => $ReturnItemCollectionMetrics,
209 'ReturnValues' => $ReturnValues,
210 'TableName' => $TableName
211 }));
212
213 0 $self->_process_request($req, \&_decode_single_item_change_response);
214 }
215  
216  
217  
218 method update_item (AttributeUpdatesType :$AttributeUpdates,
219 Str :$ConditionExpression,
220 ConditionalOperatorType :$ConditionalOperator,
221 ExpectedType :$Expected,
222 KeyType :$Key!,
223 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
224 ReturnItemCollectionMetricsType :$ReturnItemCollectionMetrics,
225 ReturnValuesType :$ReturnValues,
226 TableNameType :$TableName!,
227 ExpressionAttributeValuesType :$ExpressionAttributeValues,
228 ExpressionAttributeNamesType :$ExpressionAttributeNames,
229 Str :$UpdateExpression,
230 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine update_item: not called CC=59 SCAR=76.9
Branch: 39 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'AttributeUpdates'} ? : 0 0 0
if (exists $_{"AttributeUpdates"}) 0 0 0
exists $_{'ConditionExpression'} ? : 0 0 0
if (exists $_{"ConditionExpression"}) 0 0 0
Type::Tiny::XS::Str($ConditionExpression) or _failed_check(14, "Str", $ConditionExpression, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ConditionalOperator'} ? : 0 0 0
if (exists $_{"ConditionalOperator"}) 0 0 0
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/) or _failed_check(69, "ConditionalOperatorType", $ConditionalOperator, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'Expected'} ? : 0 0 0
if (exists $_{"Expected"}) 0 0 0
exists $_{'Key'} ? : 0 0 0
if (exists $_{"Key"}) 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnItemCollectionMetrics'} ? : 0 0 0
if (exists $_{"ReturnItemCollectionMetrics"}) 0 0 0
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/) or _failed_check(63, "ReturnItemCollectionMetricsType", $ReturnItemCollectionMetrics, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnValues'} ? : 0 0 0
if (exists $_{"ReturnValues"}) 0 0 0
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/) or _failed_check(60, "ReturnValuesType", $ReturnValues, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ExpressionAttributeValues'} ? : 0 0 0
if (exists $_{"ExpressionAttributeValues"}) 0 0 0
exists $_{'ExpressionAttributeNames'} ? : 0 0 0
if (exists $_{"ExpressionAttributeNames"}) 0 0 0
do { Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) and do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok } } or _failed_check(155, "ExpressionAttributeNamesType", $ExpressionAttributeNames, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
unless Type::Tiny::XS::Str($v) 0 0 0
unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/) 0 0 0
exists $_{'UpdateExpression'} ? : 0 0 0
if (exists $_{"UpdateExpression"}) 0 0 0
Type::Tiny::XS::Str($UpdateExpression) or _failed_check(14, "Str", $UpdateExpression, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/42
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics
!ll&&!rl&&r
000
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
!ll&&!rl&&r
000
defined $ReturnValues and not ref $ReturnValues
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) && do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
!ll&&!rl&&r
000
defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
!ll&&!rl&&r
000
defined $k and not ref $k
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
defined $ConditionalOperator not ref $ConditionalOperator not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
defined $ReturnItemCollectionMetrics not ref $ReturnItemCollectionMetrics not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
MC/DC0%0/3
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
defined $ReturnValues not ref $ReturnValues not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
MC/DC0%0/2
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) && do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
MC/DC0%0/3
defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
defined $k not ref $k not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ConditionalOperatorB= not ref $ConditionalOperatorC= not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnItemCollectionMetricsB= not ref $ReturnItemCollectionMetricsC= not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnValuesB= not ref $ReturnValuesC= not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A && B
A= Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames)B= do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $kB= not ref $kC= not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
ABCresult
0XX0
10X0
1100
1111
231 0 ▶ (defined($AttributeUpdates) xor defined($UpdateExpression)) || die("Either AttributeUpdates or UpdateExpression is required");
Branch: 1 branch
BranchTrueFalseTotal
defined $AttributeUpdates xor defined $UpdateExpression or die "Either AttributeUpdates or UpdateExpression is required" 0 0 0
Condition0%0/4
defined $AttributeUpdates xor defined $UpdateExpression
l&&rl&&!r!l&&r!l&&!r
0000
MC/DC0%0/2
defined $AttributeUpdates xor defined $UpdateExpression
defined $AttributeUpdates defined $UpdateExpression
Truth table0%0/4
A xor B
A= defined $AttributeUpdatesB= defined $UpdateExpression
ABresult
110
101
011
000
232
233 0 my $req = $self->make_request(
234 target => 'UpdateItem',
235 payload => _make_payload({
236 'AttributeUpdates' => $AttributeUpdates,
237 'ConditionalOperator' => $ConditionalOperator,
238 'ConditionExpression' => $ConditionExpression,
239 'Expected' => $Expected,
240 'ExpressionAttributeNames' => $ExpressionAttributeNames,
241 'ExpressionAttributeValues' => $ExpressionAttributeValues,
242 'Key' => $Key,
243 'ReturnConsumedCapacity' => $ReturnConsumedCapacity,
244 'ReturnItemCollectionMetrics' => $ReturnItemCollectionMetrics,
245 'ReturnValues' => $ReturnValues,
246 'TableName' => $TableName,
247 'UpdateExpression' => $UpdateExpression,
248 }));
249 0 $self->_process_request($req, \&_decode_single_item_change_response);
250 }
251  
252  
253  
254  
255 method delete_item(ConditionalOperatorType :$ConditionalOperator,
256 ExpectedType :$Expected,
257 KeyType :$Key!,
258 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
259 ReturnItemCollectionMetricsType :$ReturnItemCollectionMetrics,
260 ReturnValuesType :$ReturnValues,
261 0 ▶ TableNameType :$TableName!) {
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine BEGIN: called CC=1 SCAR=4.4
Subroutine delete_item: not called CC=37 SCAR=66.9
Branch: 24 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'ConditionalOperator'} ? : 0 0 0
if (exists $_{"ConditionalOperator"}) 0 0 0
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/) or _failed_check(69, "ConditionalOperatorType", $ConditionalOperator, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'Expected'} ? : 0 0 0
if (exists $_{"Expected"}) 0 0 0
exists $_{'Key'} ? : 0 0 0
if (exists $_{"Key"}) 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnItemCollectionMetrics'} ? : 0 0 0
if (exists $_{"ReturnItemCollectionMetrics"}) 0 0 0
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/) or _failed_check(63, "ReturnItemCollectionMetricsType", $ReturnItemCollectionMetrics, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnValues'} ? : 0 0 0
if (exists $_{"ReturnValues"}) 0 0 0
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/) or _failed_check(60, "ReturnValuesType", $ReturnValues, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/33
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics
!ll&&!rl&&r
000
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
!ll&&!rl&&r
000
defined $ReturnValues and not ref $ReturnValues
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
defined $ConditionalOperator not ref $ConditionalOperator not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
defined $ReturnItemCollectionMetrics not ref $ReturnItemCollectionMetrics not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
MC/DC0%0/3
defined $ReturnValues and not ref $ReturnValues and not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
defined $ReturnValues not ref $ReturnValues not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ConditionalOperatorB= not ref $ConditionalOperatorC= not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnItemCollectionMetricsB= not ref $ReturnItemCollectionMetricsC= not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnValuesB= not ref $ReturnValuesC= not !($ReturnValues =~ qr/(?^:^(NONE|ALL_OLD|UPDATED_OLD|ALL_NEW|UPDATED_NEW)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
262 0 my $req = $self->make_request(
263 target => 'DeleteItem',
264 payload => _make_payload({
265 'ConditionalOperator' => $ConditionalOperator,
266 'Expected' => $Expected,
267 'Key' => $Key,
268 'ReturnConsumedCapacity' => $ReturnConsumedCapacity,
269 'ReturnItemCollectionMetrics' => $ReturnItemCollectionMetrics,
270 'ReturnValues' => $ReturnValues,
271 'TableName' => $TableName
272 }));
273
274 0 $self->_process_request($req, \&_decode_single_item_change_response);
275 }
276  
277  
278  
279  
280 method get_item(CodeRef $code,
281 AttributesToGetType :$AttributesToGet,
282 StringBooleanType :$ConsistentRead,
283 KeyType :$Key!,
284 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
285 0 ▶ TableNameType :$TableName!) {
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine BEGIN: called CC=1 SCAR=4.3
Subroutine get_item: not called CC=31 SCAR=63.3
Branch: 22 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Ref::Util::XS::is_plain_coderef($code) or _failed_check(22, "CodeRef", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
if ($#_ == 1 and ref $_[1] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'AttributesToGet'} ? : 0 0 0
if (exists $_{"AttributesToGet"}) 0 0 0
exists $_{'ConsistentRead'} ? : 0 0 0
if (exists $_{"ConsistentRead"}) 0 0 0
defined $ConsistentRead and not ref $ConsistentRead and not !($ConsistentRead =~ qr/(?^:^(true|false)$)/) or _failed_check(72, "StringBooleanType", $ConsistentRead, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'Key'} ? : 0 0 0
if (exists $_{"Key"}) 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/21
$#_ == 1 and ref $_[1] eq "HASH"
!ll&&!rl&&r
000
defined $ConsistentRead and not ref $ConsistentRead and not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
!ll&&!rl&&r
000
defined $ConsistentRead and not ref $ConsistentRead
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 1 and ref $_[1] eq "HASH"
$#_ == 1 ref $_[1] eq "HASH"
MC/DC0%0/3
defined $ConsistentRead and not ref $ConsistentRead and not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
defined $ConsistentRead not ref $ConsistentRead not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
Truth table0%0/3
A and B
A= $#_ == 1B= ref $_[1] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ConsistentReadB= not ref $ConsistentReadC= not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
286 0 my $req = $self->make_request(
287 target => 'GetItem',
288 payload => _make_payload({
289 'AttributesToGet' => $AttributesToGet,
290 'ConsistentRead' => $ConsistentRead,
291 'Key' => $Key,
292 'ReturnConsumedCapacity' => $ReturnConsumedCapacity,
293 'TableName' => $TableName
294 }));
295
296 $self->_process_request(
297 $req,
298 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
299 0 my $result = shift;
300 0 my $data = decode_json($result);
301 0 $code->(_decode_item_attributes($data->{Item}));
302 0 });
303 }
304  
305  
306  
307  
308 method batch_write_item(BatchWriteRequestItemsType :$RequestItems! where { scalar(keys %$_) > 0 },
309 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
310 ReturnItemCollectionMetricsType :$ReturnItemCollectionMetrics,
311 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine batch_write_item: not called CC=28 SCAR=62.7
Branch: 14 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'RequestItems'} ? : 0 0 0
if (exists $_{"RequestItems"}) 0 0 0
do { local $_ = $RequestItems; $Kavorka::Parameter::PARAMS[58]{"constraints"}[0]->() } or Carp::croak("\$RequestItems failed value constraint") 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ReturnItemCollectionMetrics'} ? : 0 0 0
if (exists $_{"ReturnItemCollectionMetrics"}) 0 0 0
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/) or _failed_check(63, "ReturnItemCollectionMetricsType", $ReturnItemCollectionMetrics, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/15
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
!ll&&!rl&&r
000
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $ReturnItemCollectionMetrics and not ref $ReturnItemCollectionMetrics and not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
defined $ReturnItemCollectionMetrics not ref $ReturnItemCollectionMetrics not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnItemCollectionMetricsB= not ref $ReturnItemCollectionMetricsC= not !($ReturnItemCollectionMetrics =~ qr/(?^:^(NONE|SIZE)$)/)
ABCresult
0XX0
10X0
1100
1111
312 0 my @all_requests;
313  
314 0 foreach my $table_name (keys %$RequestItems) {
315 # Item.
316 0 my $table_items = $RequestItems->{$table_name};
317
318 0 my $seen_type;
319 0 foreach my $item (@$table_items) {
320 0 my $r;
321 0 foreach my $t (['DeleteRequest', 'Key'], ['PutRequest', 'Item']) {
322 0 ▶ if (defined($item->{$t->[0]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $$item{$t->[0]}) 0 0 0
323 0 my $key = $item->{$t->[0]}->{$t->[1]};
324 0 foreach my $k (keys %$key) {
325 # Don't bother encoding undefined values, same behavior as put_item
326 0 ▶ if (defined($key->{$k})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $key->{$k}) 0 0 0
327 0 $r->{$t->[0]}->{$t->[1]}->{$k} = { _encode_type_and_value($key->{$k}) };
328 }
329 }
330 }
331 }
332 0 ▶ if (defined($r)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $r) 0 0 0
333 0 push @all_requests, [$table_name, $r];
334 }
335 }
336 }
337  
338 0 ▶ try_repeat {
Subroutine __ANON__: not called CC=2 SCAR=17.9
339 0 my %payload = (
340 ReturnConsumedCapacity => $ReturnConsumedCapacity,
341 ReturnItemCollectionMetrics => $ReturnItemCollectionMetrics
342 );
343  
344 # print "Pending requests: " . scalar(@all_requests) . "\n";
345 0 my @records = splice @all_requests, 0, List::Util::min(25, scalar(@all_requests));
346
347  
348 0 foreach my $record (@records) {
349 0 push @{$payload{RequestItems}->{$record->[0]}}, $record->[1];
350 }
351
352  
353 0 my $req = $self->make_request(
354 target => 'BatchWriteItem',
355 payload => \%payload,
356 );
357  
358 $self->_process_request(
359 $req,
360 0 ▶ sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
361 0 my $result = shift;
362 0 my $data = decode_json($result);
363
364 0 ▶ if (defined($data->{UnprocessedItems})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"UnprocessedItems"}) 0 0 0
365 0 foreach my $table_name (keys %{$data->{UnprocessedItems}}) {
366 0 push @all_requests, map { [$table_name, $_] } @{$data->{UnprocessedItems}->{$table_name}};
367 }
368 }
369 0 return $data;
370 0 ▶ })->on_fail(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
371 0 @all_requests = ();
372 0 });
373 0 ▶ } until => sub { scalar(@all_requests) == 0 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
374 }
375  
376  
377  
378  
379  
380 method batch_get_item(CodeRef $code,
381 BatchGetItemsType :$RequestItems!,
382 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
383 Int :$ResultLimit where { !defined($_) || $_ > 0 }
384 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine BEGIN: called CC=1 SCAR=4.0
Subroutine batch_get_item: not called CC=27 SCAR=62.1
Branch: 18 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Ref::Util::XS::is_plain_coderef($code) or _failed_check(22, "CodeRef", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
if ($#_ == 1 and ref $_[1] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'RequestItems'} ? : 0 0 0
if (exists $_{"RequestItems"}) 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ResultLimit'} ? : 0 0 0
if (exists $_{"ResultLimit"}) 0 0 0
Type::Tiny::XS::Int($ResultLimit) or _failed_check(18, "Int", $ResultLimit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $ResultLimit; $Kavorka::Parameter::PARAMS[65]{"constraints"}[0]->() } or Carp::croak("\$ResultLimit failed value constraint") 0 0 0
Condition0%0/9
$#_ == 1 and ref $_[1] eq "HASH"
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 1 and ref $_[1] eq "HASH"
$#_ == 1 ref $_[1] eq "HASH"
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
Truth table0%0/3
A and B
A= $#_ == 1B= ref $_[1] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
385 0 my @all_requests;
386 0 my $table_flags = {};
387  
388 0 foreach my $table_name (keys %$RequestItems) {
389 0 my $table_details = $RequestItems->{$table_name};
390  
391 # Store these flags for later.
392 map {
393 0 ▶ if (defined($table_details->{$_})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $table_details->{$_}) 0 0 0
394 0 $table_flags->{$_} = $table_details->{$_};
395 }
396 } ('ConsistentRead', 'AttributesToGet');
397  
398 0 foreach my $item (@{$table_details->{Keys}}) {
399 0 my $r = {};
400 0 foreach my $key_field (keys %$item) {
401 0 $r->{$key_field} = { _encode_type_and_value($item->{$key_field}) };
402 }
403 0 push @all_requests, [$table_name, $r];
404 }
405 }
406  
407 0 my $records_seen =0;
408 0 ▶ try_repeat {
Subroutine __ANON__: not called CC=3 SCAR=24.8
409  
410 0 my %payload = (
411 ReturnConsumedCapacity => $ReturnConsumedCapacity
412 );
413  
414 # Only try 100 requests at one time.
415 0 my @records = splice @all_requests, 0, List::Util::min(100, scalar(@all_requests));
416  
417  
418 0 foreach my $record (@records) {
419 0 push @{$payload{RequestItems}->{$record->[0]}->{Keys}}, $record->[1];
420 }
421
422 0 foreach my $seen_table_name (grep { defined($table_flags->{$_}) } List::MoreUtils::uniq(map { $_->[0] } @records)) {
423 $payload{RequestItems}->{$seen_table_name} = {
424 0 %{$table_flags->{$seen_table_name}},
425 Keys => $payload{RequestItems}->{$seen_table_name}->{Keys}
426 0 };
427 }
428  
429 0 my $req = $self->make_request(
430 target => 'BatchGetItem',
431 payload => \%payload,
432 );
433  
434 $self->_process_request(
435 $req,
436 0 ▶ sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
437 0 my $result = shift;
438 0 my $data = decode_json($result);
439 0 foreach my $table_name (keys %{$data->{Responses}}) {
440 0 foreach my $item (@{$data->{Responses}->{$table_name}}) {
441 0 $code->($table_name, _decode_item_attributes($item));
442 0 $records_seen += 1;
443 0 ▶ if (defined($ResultLimit) &&$records_seen >= $ResultLimit) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ResultLimit and $records_seen >= $ResultLimit) 0 0 0
Condition0%0/3
defined $ResultLimit and $records_seen >= $ResultLimit
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ResultLimit and $records_seen >= $ResultLimit
defined $ResultLimit $records_seen >= $ResultLimit
Truth table0%0/3
A and B
A= defined $ResultLimitB= $records_seen >= $ResultLimit
ABresult
0X0
100
111
444 0 @all_requests = ();
445 0 return $data;
446 }
447 }
448 }
449
450 0 ▶ if (defined($data->{UnprocessedKeys})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"UnprocessedKeys"}) 0 0 0
451 0 foreach my $table_name (keys %{$data->{UnprocessedKeys}}) {
452 0 push @all_requests, map { [$table_name, $_] } @{$data->{UnprocessedKeys}->{$table_name}->{Keys}};
453 }
454 }
455 0 return $data;
456 0 ▶ })->on_fail(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
457 0 @all_requests = ();
458 0 });
459 0 ▶ } until => sub { scalar(@all_requests) == 0 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
460 }
461  
462  
463 method query (CodeRef $code,
464 AttributesToGetType :$AttributesToGet,
465 StringBooleanType :$ConsistentRead,
466 ConditionalOperatorType :$ConditionalOperator,
467 KeyType :$ExclusiveStartKey,
468 TableNameType :$IndexName,
469 KeyConditionsType :$KeyConditions!,
470 Int :$Limit where { $_ >= 0 },
471 QueryFilterType :$QueryFilter,
472 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
473 StringBooleanType :$ScanIndexForward,
474 SelectType :$Select,
475 TableNameType :$TableName!,
476 Str :$FilterExpression,
477 ExpressionAttributeValuesType :$ExpressionAttributeValues,
478 ExpressionAttributeNamesType :$ExpressionAttributeNames,
479 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine BEGIN: called CC=1 SCAR=4.8
Subroutine query: not called CC=75 SCAR=81.8
Branch: 52 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Ref::Util::XS::is_plain_coderef($code) or _failed_check(22, "CodeRef", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
if ($#_ == 1 and ref $_[1] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'AttributesToGet'} ? : 0 0 0
if (exists $_{"AttributesToGet"}) 0 0 0
exists $_{'ConsistentRead'} ? : 0 0 0
if (exists $_{"ConsistentRead"}) 0 0 0
defined $ConsistentRead and not ref $ConsistentRead and not !($ConsistentRead =~ qr/(?^:^(true|false)$)/) or _failed_check(72, "StringBooleanType", $ConsistentRead, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ConditionalOperator'} ? : 0 0 0
if (exists $_{"ConditionalOperator"}) 0 0 0
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/) or _failed_check(69, "ConditionalOperatorType", $ConditionalOperator, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ExclusiveStartKey'} ? : 0 0 0
if (exists $_{"ExclusiveStartKey"}) 0 0 0
exists $_{'IndexName'} ? : 0 0 0
if (exists $_{"IndexName"}) 0 0 0
do { defined $IndexName and not ref $IndexName and not !($IndexName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $IndexName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'KeyConditions'} ? : 0 0 0
if (exists $_{"KeyConditions"}) 0 0 0
exists $_{'Limit'} ? : 0 0 0
if (exists $_{"Limit"}) 0 0 0
Type::Tiny::XS::Int($Limit) or _failed_check(18, "Int", $Limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $Limit; $Kavorka::Parameter::PARAMS[74]{"constraints"}[0]->() } or Carp::croak("\$Limit failed value constraint") 0 0 0
exists $_{'QueryFilter'} ? : 0 0 0
if (exists $_{"QueryFilter"}) 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ScanIndexForward'} ? : 0 0 0
if (exists $_{"ScanIndexForward"}) 0 0 0
defined $ScanIndexForward and not ref $ScanIndexForward and not !($ScanIndexForward =~ qr/(?^:^(true|false)$)/) or _failed_check(72, "StringBooleanType", $ScanIndexForward, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'Select'} ? : 0 0 0
if (exists $_{"Select"}) 0 0 0
defined $Select and not ref $Select and not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/) or _failed_check(57, "SelectType", $Select, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'FilterExpression'} ? : 0 0 0
if (exists $_{"FilterExpression"}) 0 0 0
Type::Tiny::XS::Str($FilterExpression) or _failed_check(14, "Str", $FilterExpression, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ExpressionAttributeValues'} ? : 0 0 0
if (exists $_{"ExpressionAttributeValues"}) 0 0 0
exists $_{'ExpressionAttributeNames'} ? : 0 0 0
if (exists $_{"ExpressionAttributeNames"}) 0 0 0
do { Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) and do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok } } or _failed_check(155, "ExpressionAttributeNamesType", $ExpressionAttributeNames, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
unless Type::Tiny::XS::Str($v) 0 0 0
unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/) 0 0 0
Condition0%0/54
$#_ == 1 and ref $_[1] eq "HASH"
!ll&&!rl&&r
000
defined $ConsistentRead and not ref $ConsistentRead and not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
!ll&&!rl&&r
000
defined $ConsistentRead and not ref $ConsistentRead
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
!ll&&!rl&&r
000
defined $ConditionalOperator and not ref $ConditionalOperator
!ll&&!rl&&r
000
defined $IndexName && !ref($IndexName) && !!($IndexName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $IndexName and not ref $IndexName
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $ScanIndexForward and not ref $ScanIndexForward and not !($ScanIndexForward =~ qr/(?^:^(true|false)$)/)
!ll&&!rl&&r
000
defined $ScanIndexForward and not ref $ScanIndexForward
!ll&&!rl&&r
000
defined $Select and not ref $Select and not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
!ll&&!rl&&r
000
defined $Select and not ref $Select
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) && do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
!ll&&!rl&&r
000
defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
!ll&&!rl&&r
000
defined $k and not ref $k
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 1 and ref $_[1] eq "HASH"
$#_ == 1 ref $_[1] eq "HASH"
MC/DC0%0/3
defined $ConsistentRead and not ref $ConsistentRead and not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
defined $ConsistentRead not ref $ConsistentRead not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
MC/DC0%0/3
defined $ConditionalOperator and not ref $ConditionalOperator and not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
defined $ConditionalOperator not ref $ConditionalOperator not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
MC/DC0%0/3
defined $IndexName && !ref($IndexName) && !!($IndexName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $IndexName not ref $IndexName !!($IndexName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $ScanIndexForward and not ref $ScanIndexForward and not !($ScanIndexForward =~ qr/(?^:^(true|false)$)/)
defined $ScanIndexForward not ref $ScanIndexForward not !($ScanIndexForward =~ qr/(?^:^(true|false)$)/)
MC/DC0%0/3
defined $Select and not ref $Select and not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
defined $Select not ref $Select not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
MC/DC0%0/2
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) && do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
MC/DC0%0/3
defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
defined $k not ref $k not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
Truth table0%0/3
A and B
A= $#_ == 1B= ref $_[1] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ConsistentReadB= not ref $ConsistentReadC= not !($ConsistentRead =~ qr/(?^:^(true|false)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ConditionalOperatorB= not ref $ConditionalOperatorC= not !($ConditionalOperator =~ qr/(?^:^(AND|OR)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $IndexNameB= not ref $IndexNameC= !!($IndexName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $ScanIndexForwardB= not ref $ScanIndexForwardC= not !($ScanIndexForward =~ qr/(?^:^(true|false)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $SelectB= not ref $SelectC= not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A && B
A= Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames)B= do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $kB= not ref $kC= not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
ABCresult
0XX0
10X0
1100
1111
480  
481 0 my $payload = _make_payload({
482 'AttributesToGet' => $AttributesToGet,
483 'ConsistentRead' => $ConsistentRead,
484 'ConditionalOperator' => $ConditionalOperator,
485 'ExclusiveStartKey' => $ExclusiveStartKey,
486 'ExpressionAttributeNames' => $ExpressionAttributeNames,
487 'ExpressionAttributeValues' => $ExpressionAttributeValues,
488 'FilterExpression' => $FilterExpression,
489 'IndexName' => $IndexName,
490 'QueryFilter' => $QueryFilter,
491 'ReturnConsumedCapacity' => $ReturnConsumedCapacity,
492 'ScanIndexForward' => $ScanIndexForward,
493 'Select' => $Select,
494 'TableName' => $TableName
495 });
496
497  
498 0 foreach my $key_name (keys %$KeyConditions) {
499 0 my $key_details = $KeyConditions->{$key_name};
500 $payload->{KeyConditions}->{$key_name} = {
501 AttributeValueList => _encode_attribute_value_list($key_details->{AttributeValueList}, $key_details->{ComparisonOperator}),
502 ComparisonOperator => $key_details->{ComparisonOperator}
503 0 };
504 }
505  
506 0 $self->_scan_or_query_process('Query', $payload, $code, { ResultLimit => $Limit});
507 }
508  
509  
510  
511  
512  
513 method scan (CodeRef $code,
514 AttributesToGetType :$AttributesToGet,
515 KeyType :$ExclusiveStartKey,
516 Int :$Limit where { $_ >= 0},
517 ReturnConsumedCapacityType :$ReturnConsumedCapacity,
518 ScanFilterType :$ScanFilter,
519 Int :$Segment where { $_ >= 0 },
520 SelectType :$Select,
521 TableNameType :$TableName!,
522 Int :$TotalSegments where { $_ >= 1 && $_ <= 1000000 },
523 Str :$FilterExpression,
524 ExpressionAttributeValuesType :$ExpressionAttributeValues,
525 ExpressionAttributeNamesType :$ExpressionAttributeNames,
526 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine BEGIN: called CC=1 SCAR=4.7
Subroutine scan: not called CC=60 SCAR=77.1
Branch: 46 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Ref::Util::XS::is_plain_coderef($code) or _failed_check(22, "CodeRef", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
if ($#_ == 1 and ref $_[1] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'AttributesToGet'} ? : 0 0 0
if (exists $_{"AttributesToGet"}) 0 0 0
exists $_{'ExclusiveStartKey'} ? : 0 0 0
if (exists $_{"ExclusiveStartKey"}) 0 0 0
exists $_{'Limit'} ? : 0 0 0
if (exists $_{"Limit"}) 0 0 0
Type::Tiny::XS::Int($Limit) or _failed_check(18, "Int", $Limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $Limit; $Kavorka::Parameter::PARAMS[87]{"constraints"}[0]->() } or Carp::croak("\$Limit failed value constraint") 0 0 0
exists $_{'ReturnConsumedCapacity'} ? : 0 0 0
if (exists $_{"ReturnConsumedCapacity"}) 0 0 0
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/) or _failed_check(66, "ReturnConsumedCapacityType", $ReturnConsumedCapacity, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ScanFilter'} ? : 0 0 0
if (exists $_{"ScanFilter"}) 0 0 0
exists $_{'Segment'} ? : 0 0 0
if (exists $_{"Segment"}) 0 0 0
Type::Tiny::XS::Int($Segment) or _failed_check(18, "Int", $Segment, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $Segment; $Kavorka::Parameter::PARAMS[90]{"constraints"}[0]->() } or Carp::croak("\$Segment failed value constraint") 0 0 0
exists $_{'Select'} ? : 0 0 0
if (exists $_{"Select"}) 0 0 0
defined $Select and not ref $Select and not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/) or _failed_check(57, "SelectType", $Select, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TableName'} ? : 0 0 0
if (exists $_{"TableName"}) 0 0 0
do { defined $TableName and not ref $TableName and not !($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/) } or _failed_check(48, "TableNameType", $TableName, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'TotalSegments'} ? : 0 0 0
if (exists $_{"TotalSegments"}) 0 0 0
Type::Tiny::XS::Int($TotalSegments) or _failed_check(18, "Int", $TotalSegments, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
do { local $_ = $TotalSegments; $Kavorka::Parameter::PARAMS[93]{"constraints"}[0]->() } or Carp::croak("\$TotalSegments failed value constraint") 0 0 0
exists $_{'FilterExpression'} ? : 0 0 0
if (exists $_{"FilterExpression"}) 0 0 0
Type::Tiny::XS::Str($FilterExpression) or _failed_check(14, "Str", $FilterExpression, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'ExpressionAttributeValues'} ? : 0 0 0
if (exists $_{"ExpressionAttributeValues"}) 0 0 0
exists $_{'ExpressionAttributeNames'} ? : 0 0 0
if (exists $_{"ExpressionAttributeNames"}) 0 0 0
do { Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) and do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok } } or _failed_check(155, "ExpressionAttributeNamesType", $ExpressionAttributeNames, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
unless Type::Tiny::XS::Str($v) 0 0 0
unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/) 0 0 0
Condition0%0/30
$#_ == 1 and ref $_[1] eq "HASH"
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
!ll&&!rl&&r
000
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity
!ll&&!rl&&r
000
defined $Select and not ref $Select and not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
!ll&&!rl&&r
000
defined $Select and not ref $Select
!ll&&!rl&&r
000
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
!ll&&!rl&&r
000
defined $TableName and not ref $TableName
!ll&&!rl&&r
000
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) && do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
!ll&&!rl&&r
000
defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
!ll&&!rl&&r
000
defined $k and not ref $k
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 1 and ref $_[1] eq "HASH"
$#_ == 1 ref $_[1] eq "HASH"
MC/DC0%0/3
defined $ReturnConsumedCapacity and not ref $ReturnConsumedCapacity and not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
defined $ReturnConsumedCapacity not ref $ReturnConsumedCapacity not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
MC/DC0%0/3
defined $Select and not ref $Select and not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
defined $Select not ref $Select not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
MC/DC0%0/3
defined $TableName && !ref($TableName) && !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
defined $TableName not ref $TableName !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
MC/DC0%0/2
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) && do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames) do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
MC/DC0%0/3
defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
defined $k not ref $k not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
Truth table0%0/3
A and B
A= $#_ == 1B= ref $_[1] eq "HASH"
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $ReturnConsumedCapacityB= not ref $ReturnConsumedCapacityC= not !($ReturnConsumedCapacity =~ qr/(?^:^(INDEXES|TOTAL|NONE)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $SelectB= not ref $SelectC= not !($Select =~ qr/(?^:^(ALL_ATTRIBUTES|ALL_PROJECTED_ATTRIBUTES|SPECIFIC_ATTRIBUTES|COUNT)$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) && C
A= defined $TableNameB= not ref $TableNameC= !!($TableName =~ qr/(?^:^[a-zA-Z0-9_\-\.]{3,255}$)/)
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/3
A && B
A= Ref::Util::XS::is_plain_hashref($ExpressionAttributeNames)B= do { my $ok = 1; foreach my $v (values %{$ExpressionAttributeNames;}) { $ok = 0, last unless Type::Tiny::XS::Str($v); } ; foreach my $k (keys %{$ExpressionAttributeNames;}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/); } ; $ok }
ABresult
0X0
100
111
Truth table0%0/4
A and not(B) and C
A= defined $kB= not ref $kC= not !($k =~ qr/(?^:^\#[a-zA-Z][a-z0-9A-Z_]*$)/)
ABCresult
0XX0
10X0
1100
1111
527 0 my $payload = _make_payload({
528 'AttributesToGet' => $AttributesToGet,
529 'ExclusiveStartKey' => $ExclusiveStartKey,
530 'ExpressionAttributeValues' => $ExpressionAttributeValues,
531 'ExpressionAttributeNames' => $ExpressionAttributeNames,
532 'FilterExpression' => $FilterExpression,
533 'ReturnConsumedCapacity' => $ReturnConsumedCapacity,
534 'ScanFilter' => $ScanFilter,
535 'Segment' => $Segment,
536 'Select' => $Select,
537 'TableName' => $TableName,
538 'TotalSegments' => $TotalSegments
539 });
540  
541 0 $self->_scan_or_query_process('Scan', $payload, $code, { ResultLimit => $Limit});
542 }
543  
544  
545 method make_request(Str :$target,
546 HashRef :$payload,
547 0 ▶ ) {
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine make_request: not called CC=18 SCAR=52.6
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'target'} ? : 0 0 0
if (exists $_{"target"}) 0 0 0
Type::Tiny::XS::Str($target) or _failed_check(14, "Str", $target, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
exists $_{'payload'} ? : 0 0 0
if (exists $_{"payload"}) 0 0 0
Ref::Util::XS::is_plain_hashref($payload) or _failed_check(27, "HashRef", $payload, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
548 0 my $api_version = '20120810';
549 0 my $host = $self->host;
550 0 ▶ my $req = HTTP::Request->new(
Branch: 2 branches
BranchTrueFalseTotal
$self->ssl ? : 0 0 0
$self->port ? : 0 0 0
551 POST => (($self->ssl) ? 'https' : 'http') . '://' . $self->host . ($self->port ? (':' . $self->port) : '') . '/'
552 );
553 0 $req->header( host => $host );
554 # Amazon requires ISO-8601 basic format
555 0 my $now = time;
556 0 my $http_date = strftime('%Y%m%dT%H%M%SZ', gmtime($now));
557 0 my $date = strftime('%Y%m%d', gmtime($now));
558  
559 0 $req->protocol('HTTP/1.1');
560 0 $req->header( 'Date' => $http_date );
561 0 $req->header( 'x-amz-target', 'DynamoDB_'. $api_version. '.'. $target );
562 0 $req->header( 'content-type' => 'application/x-amz-json-1.0' );
563 0 $payload = encode_json($payload);
564 0 $req->content($payload);
565 0 $req->header( 'Content-Length' => length($payload));
566
567 0 ▶ if ($self->{use_iam_role}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"use_iam_role"}) 0 0 0
568 0 my $creds = VM::EC2::Security::CredentialCache->get();
569 0 ▶ defined($creds) || die("Unable to retrieve IAM role credentials");
Branch: 1 branch
BranchTrueFalseTotal
defined $creds or die "Unable to retrieve IAM role credentials" 0 0 0
570 0 $self->{access_key} = $creds->accessKeyId;
571 0 $self->{secret_key} = $creds->secretAccessKey;
572 0 $req->header('x-amz-security-token' => $creds->sessionToken);
573 }
574  
575 0 my $signer = AWS::Signature4->new(-access_key => $self->access_key,
576 -secret_key => $self->secret_key);
577
578 0 $signer->sign($req);
579 0 return $req;
580 }
581  
582 0 ▶method _request(HTTP::Request $req) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine _request: not called CC=6 SCAR=30.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($req) or _failed_check(158, "InstanceOf[\"HTTP::Request\"]", $req, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
583 0 $self->implementation->request($req);
584 }
585  
586  
587 # Since scan and query have the same type of responses share the processing.
588 method _scan_or_query_process (Str $target,
589 HashRef $payload,
590 CodeRef $code,
591 0 ▶ HashRef $args) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine _scan_or_query_process: not called CC=15 SCAR=50.4
Branch: 14 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 4 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($target) or _failed_check(14, "Str", $target, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
Ref::Util::XS::is_plain_hashref($payload) or _failed_check(27, "HashRef", $payload, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 2 ? : 0 0 0
if ($#_ >= 2) 0 0 0
Ref::Util::XS::is_plain_coderef($code) or _failed_check(22, "CodeRef", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 3 ? : 0 0 0
if ($#_ >= 3) 0 0 0
Ref::Util::XS::is_plain_hashref($args) or _failed_check(27, "HashRef", $args, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
592 0 my $finished = 0;
593 0 my $records_seen = 0;
594 0 ▶ my $repeat = try_repeat {
Subroutine __ANON__: not called CC=2 SCAR=17.9
595
596 # Since we're may be making more than one request in this repeat loop
597 # decrease our limit of results to scan in each call by the number
598 # of records remaining that the overall request wanted ot pull.
599 0 ▶ if (defined($args->{ResultLimit})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{"ResultLimit"}) 0 0 0
600 0 $payload->{Limit} = $args->{ResultLimit} - $records_seen;
601 }
602  
603 0 my $req = $self->make_request(
604 target => $target,
605 payload => $payload,
606 );
607
608 $self->_process_request(
609 $req,
610 0 ▶ sub {
Subroutine __ANON__: not called CC=8 SCAR=42.8
611 0 my $result = shift;
612 0 my $data = decode_json($result);
613
614 0 for my $entry (@{$data->{Items}}) {
615 0 $code->(_decode_item_attributes($entry));
616 }
617  
618 0 $records_seen += scalar(@{$data->{Items}});
619 0 ▶ if ((defined($args->{ResultLimit}) && $records_seen >= $args->{ResultLimit})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{"ResultLimit"} and $records_seen >= $args->{"ResultLimit"}) 0 0 0
Condition0%0/3
defined $args->{"ResultLimit"} and $records_seen >= $args->{"ResultLimit"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $args->{"ResultLimit"} and $records_seen >= $args->{"ResultLimit"}
defined $args->{"ResultLimit"} $records_seen >= $args->{"ResultLimit"}
Truth table0%0/3
A and B
A= defined $args->{"ResultLimit"}B= $records_seen >= $args->{"ResultLimit"}
ABresult
0X0
100
111
620 0 $finished = 1;
621 }
622  
623 0 ▶ if (!defined($data->{LastEvaluatedKey})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $data->{'LastEvaluatedKey'}) { } 0 0 0
624 0 $finished = 1;
625 } else {
626 0 ▶ if (!$finished) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($finished) 0 0 0
627 0 $payload->{ExclusiveStartKey} = $data->{LastEvaluatedKey};
628 }
629 }
630
631 0 ▶ if (defined($data->{LastEvaluatedKey}) && $finished) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"LastEvaluatedKey"} and $finished) 0 0 0
Condition0%0/3
defined $data->{"LastEvaluatedKey"} and $finished
!ll&&!rl&&r
000
MC/DC0%0/2
defined $data->{"LastEvaluatedKey"} and $finished
defined $data->{"LastEvaluatedKey"} $finished
Truth table0%0/3
A and B
A= defined $data->{"LastEvaluatedKey"}B= $finished
ABresult
0X0
100
111
632 0 $data->{LastEvaluatedKey} = _decode_item_attributes($data->{LastEvaluatedKey});
633 }
634  
635  
636 0 return $data;
637 })
638 0 ▶ ->on_fail(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
639 0 $finished = 1;
640 0 });
641 0 ▶ } until => sub { $finished };
Subroutine __ANON__: not called CC=1 SCAR=6.9
642 }
643  
644  
645  
646 0 ▶fun _encode_type_and_value(Any $v) {
Subroutine BEGIN: called CC=1 SCAR=2.4
Subroutine BEGIN: called CC=1 SCAR=2.4
Subroutine _encode_type_and_value: not called CC=19 SCAR=56.8
Branch: 3 branches
BranchTrueFalseTotal
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
647 0 my $type;
648  
649 0 ▶ if (ref($v)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $v) { } 0 0 0
650 # An array maps to a sequence
651 0 ▶ if (ref($v) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $v eq 'ARRAY') { } 0 0 0
652 # Any refs mean we're sending binary data
653
654 # Start by guessing we have an array of numeric strings,
655 # but on the first value we encoutner that is either a reference
656 # or a variable that isn't an integer or numeric. Stop.
657 0 $type = 'NS';
658 0 foreach my $value (@$v) {
659 0 ▶ if (ref($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value) 0 0 0
660 0 $type = 'BS';
661 0 last;
662 }
663 0 my $element_flags = B::svref_2object(\$value)->FLAGS;
664 0 ▶ if ($element_flags & (B::SVp_IOK | B::SVp_NOK)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($element_flags & 12288) 0 0 0
665 0 next;
666 }
667 0 $type = 'SS';
668 0 last;
669 }
670 } else {
671 0 ▶ ref($v) eq 'SCALAR' || Carp::confess("Reference found but not a scalar");
Branch: 1 branch
BranchTrueFalseTotal
ref $v eq "SCALAR" or Carp::confess("Reference found but not a scalar") 0 0 0
672 0 $type = 'B';
673 }
674 } else {
675 0 my $flags = B::svref_2object(\$v)->FLAGS;
676 0 ▶ if ($flags & B::SVp_POK) {
Branch: 2 branches
BranchTrueFalseTotal
if ($flags & 16384) { } 0 0 0
elsif ($flags & 12288) { } 0 0 0
677 0 $type = 'S';
678 } elsif ($flags & (B::SVp_IOK | B::SVp_NOK)) {
679 0 $type = 'N';
680 } else {
681 0 $type = 'S';
682 }
683 }
684
685 0 ▶ if ($type eq 'N' || $type eq 'S') {
Branch: 4 branches
BranchTrueFalseTotal
if ($type eq 'N' or $type eq 'S') { } 0 0 0
elsif ($type eq 'B') { } 0 0 0
elsif ($type eq 'NS' or $type eq 'SS') { } 0 0 0
elsif ($type eq 'BS') { } 0 0 0
Condition0%0/3
$type eq "N" or $type eq "S"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "N" or $type eq "S"
$type eq "N" $type eq "S"
Truth table0%0/3
A or B
A= $type eq "N"B= $type eq "S"
ABresult
1X1
011
000
686 0 ▶ defined($v) || Carp::confess("Attempt to encode undefined value");
Branch: 1 branch
BranchTrueFalseTotal
defined $v or Carp::confess("Attempt to encode undefined value") 0 0 0
687 0 return ($type, "$v");
688 } elsif ($type eq 'B') {
689 0 return ($type, MIME::Base64::encode_base64(${$v}, ''));
690 ▶ } elsif ($type eq 'NS' || $type eq 'SS') {
Condition0%0/3
$type eq "NS" or $type eq "SS"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "NS" or $type eq "SS"
$type eq "NS" $type eq "SS"
Truth table0%0/3
A or B
A= $type eq "NS"B= $type eq "SS"
ABresult
1X1
011
000
691 0 return ($type, [map { "$_" } @$v]);
692 } elsif ($type eq 'BS') {
693 0 return ($type, [map { MIME::Base64::encode_base64(${$_}, '') } @$v]);
694 } else {
695 0 die("Unknown type for quoting and escaping: $type");
696 }
697 }
698  
699 0 ▶fun _decode_type_and_value(Str $type, Any $value) {
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine _decode_type_and_value: not called CC=13 SCAR=46.7
Branch: 6 branches
BranchTrueFalseTotal
if @_ != 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($type) or _failed_check(14, "Str", $type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
700 0 ▶ if ($type eq 'S' || $type eq 'SS') {
Branch: 5 branches
BranchTrueFalseTotal
if ($type eq 'S' or $type eq 'SS') { } 0 0 0
elsif ($type eq 'N') { } 0 0 0
elsif ($type eq 'B') { } 0 0 0
elsif ($type eq 'BS') { } 0 0 0
elsif ($type eq 'NS') { } 0 0 0
Condition0%0/3
$type eq "S" or $type eq "SS"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "S" or $type eq "SS"
$type eq "S" $type eq "SS"
Truth table0%0/3
A or B
A= $type eq "S"B= $type eq "SS"
ABresult
1X1
011
000
701 0 return $value;
702 } elsif ($type eq 'N') {
703 0 return 0+$value;
704 } elsif ($type eq 'B') {
705 0 return MIME::Base64::decode_base64($value);
706 } elsif ($type eq 'BS') {
707 0 return [map { MIME::Base64::decode_base64($_) } @$value];
708 } elsif ($type eq 'NS') {
709 0 return [map { 0+$_} @$value];
710 } else {
711 0 die("Don't know how to decode type: $type");
712 }
713 }
714  
715  
716 0 ▶fun _decode_item_attributes(Maybe[HashRef] $item) {
Subroutine BEGIN: called CC=1 SCAR=2.8
Subroutine BEGIN: called CC=1 SCAR=2.8
Subroutine _decode_item_attributes: not called CC=6 SCAR=30.8
Branch: 4 branches
BranchTrueFalseTotal
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC3($item) or _failed_check(160, "Maybe[HashRef]", $item, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
717 0 my $r;
718 0 foreach my $key (keys %$item) {
719 0 my $type = (keys %{$item->{$key}})[0];
720 0 my $value = $item->{$key}->{$type};
721 0 $r->{$key} = _decode_type_and_value($type, $item->{$key}->{$type});
722 }
723 0 return $r;
724 }
725  
726 0 ▶method _process_request(HTTP::Request $req, CodeRef $done?) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine _process_request: not called CC=10 SCAR=44.6
Branch: 9 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
if @_ > 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($req) or _failed_check(158, "InstanceOf[\"HTTP::Request\"]", $req, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
Ref::Util::XS::is_plain_coderef($done) or _failed_check(22, "CodeRef", $done, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
727 0 my $current_retry = 0;
728 0 my $do_retry = 1;
729 0 ▶ try_repeat {
Subroutine __ANON__: not called CC=3 SCAR=24.8
730 0 $do_retry = 0;
731
732 0 my $sleep_amount = 0;
733 0 ▶ if ($current_retry > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_retry > 0) 0 0 0
734 0 $sleep_amount = (2 ** $current_retry * 50)/1000;
735 }
736  
737 0 ▶ my $complete = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
738 $self->_request($req)->transform(
739 0 ▶ fail => sub {
Subroutine __ANON__: not called CC=15 SCAR=54.8
740 0 my ($status, $resp, $req)= @_;
741 0 my $r;
742 0 ▶ if (defined($resp) && defined($resp->code)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $resp and defined $resp->code) 0 0 0
Condition0%0/3
defined $resp and defined $resp->code
!ll&&!rl&&r
000
MC/DC0%0/2
defined $resp and defined $resp->code
defined $resp defined $resp->code
Truth table0%0/3
A and B
A= defined $respB= defined $resp->code
ABresult
0X0
100
111
743 0 ▶ if ($resp->code == 500) {
Branch: 2 branches
BranchTrueFalseTotal
if ($resp->code == 500) { } 0 0 0
elsif ($resp->code == 400) { } 0 0 0
744 0 $do_retry = 1;
745 0 $current_retry++;
746 } elsif ($resp->code == 400) {
747 0 ▶ my $json = $resp->can('decoded_content')
Branch: 1 branch
BranchTrueFalseTotal
$resp->can('decoded_content') ? : 0 0 0
748 ? $resp->decoded_content
749 : $resp->body; # Mojo
750 0 $r = decode_json($json);
751 0 ▶ if ($r->{__type} =~ /ProvisionedThroughputExceededException$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->{'__type'} =~ /ProvisionedThroughputExceededException$/) { } 0 0 0
752 # Need to sleep
753 0 $do_retry = 1;
754 0 $current_retry++;
755
756
757 } else {
758 # extract the type into a better prettyier name.
759 0 ▶ if ($r->{__type} =~ /^com\.amazonaws\.dynamodb\.v20120810#(.+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->{"__type"} =~ /^com\.amazonaws\.dynamodb\.v20120810#(.+)$/) 0 0 0
760 0 $r->{type} = $1;
761 }
762 }
763 }
764 }
765
766 0 ▶ if (defined($self->max_retries()) && $current_retry > $self->max_retries()) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->max_retries and $current_retry > $self->max_retries) 0 0 0
Condition0%0/3
defined $self->max_retries and $current_retry > $self->max_retries
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->max_retries and $current_retry > $self->max_retries
defined $self->max_retries $current_retry > $self->max_retries
Truth table0%0/3
A and B
A= defined $self->max_retriesB= $current_retry > $self->max_retries
ABresult
0X0
100
111
767 0 $do_retry = 0;
768 }
769  
770 0 ▶ if (!$do_retry) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $do_retry) 0 0 0
771 0 ▶ if ($self->debug_failures()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->debug_failures) 0 0 0
772 0 print "DynamoDB Failure: $status\n";
773 0 ▶ if (defined($resp)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $resp) 0 0 0
774 0 print "response:\n";
775 0 print $resp->as_string() . "\n";
776 }
777 0 ▶ if (defined($req)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $req) 0 0 0
778 0 print "Request:\n";
779 0 print $req->as_string() . "\n";
780 }
781 }
782 0 ▶ return $r || $status;
Condition0%0/3
$r || $status
l!l&&r!l&&!r
000
MC/DC0%0/2
$r || $status
$r $status
Truth table0%0/3
A || B
A= $rB= $status
ABresult
1X1
011
000
783 }
784 },
785 0 done => $done);
786 0 };
787  
788 0 ▶ if ($sleep_amount > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sleep_amount > 0) { } 0 0 0
789 0 $self->{implementation}->delay($sleep_amount)->then($complete);
790 } else {
791 0 $complete->();
792 }
793 0 ▶ } until => sub { !$do_retry };
Subroutine __ANON__: not called CC=1 SCAR=6.9
794 }
795  
796 0 ▶my $encode_key = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
797 0 my $source = shift;
798 0 my $r;
799 0 foreach my $k (keys %$source) {
800 0 my $v = $source->{$k};
801 # There is no sense in encoding undefined values or values that
802 # are the empty string.
803 0 ▶ if (defined($v) && $v ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $v and $v ne "") 0 0 0
Condition0%0/3
defined $v and $v ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $v and $v ne ""
defined $v $v ne ""
Truth table0%0/3
A and B
A= defined $vB= $v ne ""
ABresult
0X0
100
111
804 # Reference $source->{$k} since the earlier test may cause
805 # the value to be stringified.
806 0 $r->{$k} = { _encode_type_and_value($source->{$k}) };
807 }
808 }
809 0 return $r;
810 11 };
811  
812  
813 0 ▶fun _encode_attribute_value_list(Any $value_list, Str $compare_op) {
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine BEGIN: called CC=1 SCAR=3.0
Subroutine _encode_attribute_value_list: not called CC=14 SCAR=48.5
Branch: 6 branches
BranchTrueFalseTotal
if @_ != 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
Type::Tiny::XS::Str($compare_op) or _failed_check(14, "Str", $compare_op, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
814 0 ▶ if ($compare_op =~ /^(EQ|NE|LE|LT|GE|GT|CONTAINS|NOT_CONTAINS|BEGINS_WITH)$/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($compare_op =~ /^(EQ|NE|LE|LT|GE|GT|CONTAINS|NOT_CONTAINS|BEGINS_WITH)$/) { } 0 0 0
elsif ($compare_op eq 'IN') { } 0 0 0
elsif ($compare_op eq 'BETWEEN') { } 0 0 0
815 0 ▶ defined($value_list) || Carp::confess("No defined value for comparison operator: $compare_op");
Branch: 1 branch
BranchTrueFalseTotal
defined $value_list or Carp::confess("No defined value for comparison operator: $compare_op") 0 0 0
816 0 $value_list = [ { _encode_type_and_value($value_list) } ];
817 } elsif ($compare_op eq 'IN') {
818 0 ▶ if (!ref($value_list)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $value_list) 0 0 0
819 0 $value_list = [$value_list];
820 }
821 0 $value_list = [ map { { _encode_type_and_value($_) } } @$value_list];
822 } elsif ($compare_op eq 'BETWEEN') {
823 0 ▶ ref($value_list) eq 'ARRAY' || Carp::confess("Use of BETWEEN comparison operator requires an array");
Branch: 1 branch
BranchTrueFalseTotal
ref $value_list eq "ARRAY" or Carp::confess("Use of BETWEEN comparison operator requires an array") 0 0 0
824 0 ▶ scalar(@$value_list) == 2 || Carp::confess("BETWEEN comparison operator requires two values");
Branch: 1 branch
BranchTrueFalseTotal
scalar @$value_list == 2 or Carp::confess("BETWEEN comparison operator requires two values") 0 0 0
825 0 $value_list = [ map { { _encode_type_and_value($_) } } @$value_list];
826 }
827 0 return $value_list;
828 }
829  
830 0 ▶my $encode_filter = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
831 0 my $source = shift;
832  
833 0 my $r;
834  
835 0 foreach my $field_name (keys %$source) {
836 0 my $f = $source->{$field_name};
837 0 ▶ my $compare_op = $f->{ComparisonOperator} // 'EQ';
Condition0%0/2
$f->{"ComparisonOperator"} // "EQ"
l!l
00
MC/DC0%0/1
$f->{"ComparisonOperator"} // "EQ"
$f->{"ComparisonOperator"}
Truth table0%0/2
A
A= $f->{"ComparisonOperator"}
Aresult
11
00
838 0 ▶ $compare_op =~ /^(EQ|NE|LE|LT|GE|GT|NOT_NULL|NULL|CONTAINS|NOT_CONTAINS|BEGINS_WITH|IN|BETWEEN)$/
Branch: 1 branch
BranchTrueFalseTotal
$compare_op =~ /^(EQ|NE|LE|LT|GE|GT|NOT_NULL|NULL|CONTAINS|NOT_CONTAINS|BEGINS_WITH|IN|BETWEEN)$/ or Carp::confess("Unknown comparison operator specified: $compare_op") 0 0 0
839 || Carp::confess("Unknown comparison operator specified: $compare_op");
840
841 $r->{$field_name} = {
842 ComparisonOperator => $compare_op,
843 0 ▶ (defined($f->{AttributeValueList}) ? (AttributeValueList => _encode_attribute_value_list($f->{AttributeValueList}, $compare_op)) : ())
Branch: 1 branch
BranchTrueFalseTotal
defined $f->{'AttributeValueList'} ? : 0 0 0
844 };
845 }
846 0 return $r;
847 11 };
848  
849 my $parameter_type_definitions = {
850 AttributesToGet => {},
851 AttributeUpdates => {
852 0 ▶ encode => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
853 0 my $source = shift;
854 0 my $r;
855 0 ▶ ref($source) eq 'HASH' || Carp::confess("Attribute updates is not a hash ref");
Branch: 1 branch
BranchTrueFalseTotal
ref $source eq "HASH" or Carp::confess("Attribute updates is not a hash ref") 0 0 0
856 0 foreach my $k (keys %$source) {
857 0 my $op = $source->{$k};
858 0 ▶ ref($op) eq 'HASH' || Carp::confess("AttributeUpdate for field $k is not a hash ref:" . Data::Dumper->Dump([$op]));
Branch: 1 branch
BranchTrueFalseTotal
ref $op eq "HASH" or Carp::confess("AttributeUpdate for field $k is not a hash ref:" . "Data::Dumper"->Dump([$op])) 0 0 0
859 $r->{$k} = {
860 (defined($op->{Action}) ? (Action => $op->{Action}) : ()),
861 0 ▶ (defined($op->{Value}) ? (Value => { _encode_type_and_value($op->{Value}) }) : ()),
Branch: 2 branches
BranchTrueFalseTotal
defined $op->{'Action'} ? : 0 0 0
defined $op->{'Value'} ? : 0 0 0
862 };
863 }
864 0 return $r;
865 }
866 },
867 # should be a boolean
868 ConsistentRead => {},
869 ConditionalOperator => {},
870 ConditionExpression => {},
871 ExclusiveStartKey => {
872 encode => $encode_key,
873 },
874 ExclusiveStartTableName => {},
875 ExpressionAttributeNames => {},
876 ExpressionAttributeValues => {
877 0 ▶ encode => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
878 0 my $source = shift;
879 0 my $r;
880 0 foreach my $key (grep { defined($source->{$_}) } keys %$source) {
881 0 $r->{$key} = { _encode_type_and_value($source->{$key}) };
882 }
883 0 return $r;
884 }
885 },
886 Expected => {
887 0 ▶ encode => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
888 0 my $source = shift;
889 0 my $r;
890 0 foreach my $key (keys %$source) {
891 0 my $info = $source->{$key};
892  
893 0 ▶ if (defined($info->{AttributeValueList}) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info->{"AttributeValueList"}) 0 0 0
894 0 $r->{$key}->{AttributeValueList} = _encode_attribute_value_list($info->{AttributeValueList}, $info->{ComparisonOperator});
895 }
896  
897 0 ▶ if (defined($info->{Exists})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info->{"Exists"}) 0 0 0
898 0 $r->{$key}->{Exists} = $info->{Exists};
899 }
900  
901 0 ▶ if (defined($info->{ComparisonOperator})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info->{"ComparisonOperator"}) 0 0 0
902 0 $r->{$key}->{ComparisonOperator} = $info->{ComparisonOperator};
903 }
904
905 0 ▶ if (defined($info->{Value})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info->{"Value"}) 0 0 0
906 0 $r->{$key}->{Value} = { _encode_type_and_value($info->{Value}) };
907 }
908 }
909 0 return $r;
910 },
911 },
912 11 FilterExpression => {},
913 IndexName => {},
914 Item => {
915 encode => $encode_key,
916 },
917 Key => {
918 encode => $encode_key,
919 },
920 Limit => {
921 type_check => 'integer',
922 },
923 QueryFilter => {
924 encode => $encode_filter,
925 },
926 ReturnConsumedCapacity => {},
927 ReturnItemCollectionMetrics => {},
928 ReturnValues => {},
929 ScanIndexForward => {},
930 ScanFilter => {
931 encode => $encode_filter,
932 },
933 Segment => {
934 type_check => 'integer',
935 },
936 Select => {},
937 TableName => {},
938 TotalSegments => {
939 type_check => 'integer',
940 },
941 UpdateExpression => {},
942 };
943  
944  
945  
946  
947 # Build a parameter hash from all of the standardized parameters.
948 0 ▶sub _make_payload {
Subroutine _make_payload: not called CC=11 SCAR=48.8
949 0 my $args = shift;
950 0 my @field_names = @_;
951  
952 0 ▶ if (scalar(@field_names) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @field_names == 0) 0 0 0
953 0 @field_names = keys %$args;
954 }
955  
956 0 my %r;
957 0 foreach my $field_name (@field_names) {
958 0 my $value = $args->{$field_name};
959 0 ▶ if (!defined($value)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 0 0 0
960 0 next;
961 }
962 0 ▶ my $def = $parameter_type_definitions->{$field_name} || Carp::confess("Unknown parameter type: $field_name");
Condition0%0/2
$parameter_type_definitions->{$field_name} || Carp::confess("Unknown parameter type: $field_name")
l!l
00
MC/DC0%0/1
$parameter_type_definitions->{$field_name} || Carp::confess("Unknown parameter type: $field_name")
$parameter_type_definitions->{$field_name}
Truth table0%0/2
A
A= $parameter_type_definitions->{$field_name}
Aresult
11
00
963 0 ▶ if (defined($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
964 0 ▶ if ($def->{type_check} && $def->{type_check} eq 'integer') {
Branch: 1 branch
BranchTrueFalseTotal
if ($def->{"type_check"} and $def->{"type_check"} eq "integer") 0 0 0
Condition0%0/3
$def->{"type_check"} and $def->{"type_check"} eq "integer"
!ll&&!rl&&r
000
MC/DC0%0/2
$def->{"type_check"} and $def->{"type_check"} eq "integer"
$def->{"type_check"} $def->{"type_check"} eq "integer"
Truth table0%0/3
A and B
A= $def->{"type_check"}B= $def->{"type_check"} eq "integer"
ABresult
0X0
100
111
965 0 ▶ $value =~ /^\d+$/ || Carp::confess("$field_name is specified to be an integer but the value is not an integer: $value");
Branch: 1 branch
BranchTrueFalseTotal
$value =~ /^\d+$/ or Carp::confess("$field_name is specified to be an integer but the value is not an integer: $value") 0 0 0
966 0 $value = int($value);
967 }
968 }
969  
970 0 ▶ if (defined($def->{encode})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $def->{"encode"}) 0 0 0
971 0 $value = $def->{encode}->($value);
972 }
973  
974 0 ▶ if (defined($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
975 0 $r{$field_name} = $value;
976 }
977 }
978 0 return \%r;
979 }
980  
981 0 ▶fun _decode_single_item_change_response(Str $response) {
Subroutine BEGIN: called CC=1 SCAR=2.8
Subroutine BEGIN: called CC=1 SCAR=2.8
Subroutine _decode_single_item_change_response: not called CC=9 SCAR=39.4
Branch: 4 branches
BranchTrueFalseTotal
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($response) or _failed_check(14, "Str", $response, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
982 0 my $r = decode_json($response);
983 0 ▶ if (defined($r->{Attributes})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $r->{"Attributes"}) 0 0 0
984 0 $r->{Attributes} = _decode_item_attributes($r->{Attributes});
985 }
986
987 0 ▶ if (defined($r->{ItemCollectionMetrics})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $r->{"ItemCollectionMetrics"}) 0 0 0
988 0 foreach my $key (keys %{$r->{ItemCollectionMetrics}}) {
989 0 foreach my $key_part (keys %{$r->{ItemCollectionMetrics}->{$key}}) {
990 0 $r->{ItemCollectionMetrics}->{$key}->{$key_part} = _decode_item_attributes($r->{ItemCollectionMetrics}->{$key})
991 }
992 }
993 }
994 0 return $r;
995 }
996  
997  
998 0 ▶fun _create_key_schema(ArrayRef $source, HashRef $known_fields) {
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine BEGIN: called CC=1 SCAR=3.2
Subroutine _create_key_schema: not called CC=13 SCAR=46.1
Branch: 7 branches
BranchTrueFalseTotal
if @_ != 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Ref::Util::XS::is_plain_arrayref($source) or _failed_check(26, "ArrayRef", $source, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
Ref::Util::XS::is_plain_hashref($known_fields) or _failed_check(27, "HashRef", $known_fields, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
999 0 ▶ defined($source) || die("No source passed to create_key_schema");
Branch: 1 branch
BranchTrueFalseTotal
defined $source or die "No source passed to create_key_schema" 0 0 0
1000 0 ▶ defined($known_fields) || die("No known fields passed to create_key_schmea");
Branch: 1 branch
BranchTrueFalseTotal
defined $known_fields or die "No known fields passed to create_key_schmea" 0 0 0
1001 0 my @r;
1002 0 foreach my $field_name (@$source) {
1003 0 ▶ defined($known_fields->{$field_name}) || Carp::confess("Unknown field specified '$field_name' in schema, must be defined in fields. schema:" . Data::Dumper->Dump([$source]));
Branch: 1 branch
BranchTrueFalseTotal
defined $known_fields->{$field_name} or Carp::confess("Unknown field specified '${field_name}' in schema, must be defined in fields. schema:" . "Data::Dumper"->Dump([$source])) 0 0 0
1004 0 ▶ push @r, {
Branch: 1 branch
BranchTrueFalseTotal
scalar @r ? : 0 0 0
1005 AttributeName => $field_name,
1006 KeyType => (scalar(@r) ? 'RANGE' : 'HASH')
1007 };
1008 }
1009 0 return \@r;
1010 };
1011  
1012  
1013  
1014 11 1;
1015  
1016 __END__
↑ Summary lib/Amazon/DynamoDB.pm »