SDK/Storage/Blobs.pm

filter: Statementstmt 100% 167 / 167 Branchbran 73.0% 57 / 78 Conditioncond 50.0% 36 / 72 MC/DCmcdc 17.9% 7 / 39 Subroutinesub 100% 30 / 30 Podpod 100% 9 / 9 totaltotal 77.4% 306 / 395 CC 65 SCAR 23.5
CC
65
Cov
82%
__ANON__
22.9
upload_blob
19.4
_strong_etag
12.0
CRAP 10.4
« SDK/Storage/Tables/Entity.pm ↑ Summary SDK/Storage/Tables.pm »
1 2 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 2 ▶use Azure::SDK::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Azure::SDK::Core::ClientOptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Azure::SDK::Core::Pager;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Azure::SDK::Core::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Azure::SDK::Core::Credential::Sas;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Azure::SDK::Storage::Blobs::ConnectionString;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Azure::SDK::Storage::Blobs::Serializer;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Azure::SDK::Storage::Blobs::SharedKey;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Azure::SDK::Storage::Blobs::Uri;
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15 2 class Azure::SDK::Storage::Blobs {
16 2 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶ use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶ use URI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19
20 2 ▶ use constant API_VERSION => '2025-11-05';
Subroutine BEGIN: called CC=1 SCAR=0.0
21
22 2 field $connection_string :param = undef;
23 2 field $endpoint :param = undef;
24 2 field $credential :param = undef;
25 2 field $options :param = undef;
26
27 2 field $connection :reader = undef;
28 2 field $uri :reader = undef;
29 2 field $serializer :reader = undef;
30 2 field $core :reader = undef;
31
32 29 ▶ ADJUST {
Subroutine __ANON__: called CC=19 SCAR=31.3
33 29 ▶ croak 'Blob connection_string cannot be combined with endpoint or credential'
Branch: 1 branch
BranchTrueFalseTotal
if defined $connection_string and defined $endpoint || defined $credential 1 28 29
Condition83%5/6
defined $connection_string and defined $endpoint || defined $credential
!ll&&!rl&&r
11171
defined $endpoint or defined $credential
l!l&&r!l&&!r
1017
MC/DC66%2/3
defined $connection_string and defined $endpoint || defined $credential
defined $connection_string defined $endpoint defined $credential
Truth table75%3/4
A and B or C
A= defined $connection_stringB= defined $endpointC= defined $credential
ABCresult
0XX0
1000
11X1
1011
34 if defined $connection_string && (defined $endpoint || defined $credential);
35
36 28 my $auth_credential;
37 my @signers;
38 28 ▶ if (defined $connection_string) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $connection_string) { } 17 11 28
39 17 ▶ $connection = blessed($connection_string)
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($connection_string) && $connection_string->isa('Azure::SDK::Storage::Blobs::ConnectionString') ? : 0 17 17
Condition33%1/3
builtin::blessed($connection_string) and $connection_string->isa("Azure::SDK::Storage::Blobs::ConnectionString")
!ll&&!rl&&r
1700
MC/DC0%0/2
builtin::blessed($connection_string) and $connection_string->isa("Azure::SDK::Storage::Blobs::ConnectionString")
builtin::blessed($connection_string) $connection_string->isa("Azure::SDK::Storage::Blobs::ConnectionString")
Truth table33%1/3
A and B
A= builtin::blessed($connection_string)B= $connection_string->isa("Azure::SDK::Storage::Blobs::ConnectionString")
ABresult
0X0
100
111
40 && $connection_string->isa('Azure::SDK::Storage::Blobs::ConnectionString')
41 ? $connection_string
42 : Azure::SDK::Storage::Blobs::ConnectionString->parse($connection_string);
43 14 $uri = Azure::SDK::Storage::Blobs::Uri->from_connection_string($connection);
44 14 $auth_credential = $connection->credential;
45 14 ▶ push @signers, Azure::SDK::Storage::Blobs::SharedKey->new(
Branch: 1 branch
BranchTrueFalseTotal
if $auth_credential->isa("Azure::SDK::Core::Credential::SharedKey") 12 2 14
46 credential => $auth_credential,
47 api_version => API_VERSION,
48 ) if $auth_credential->isa('Azure::SDK::Core::Credential::SharedKey');
49 }
50 else {
51 11 ▶ croak 'Blob endpoint is required for SAS authentication'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $endpoint and length $endpoint 0 11 11
Condition33%1/3
defined $endpoint and length $endpoint
!ll&&!rl&&r
0011
MC/DC0%0/2
defined $endpoint and length $endpoint
defined $endpoint length $endpoint
Truth table33%1/3
A and B
A= defined $endpointB= length $endpoint
ABresult
0X0
100
111
52 unless defined $endpoint && length $endpoint;
53 11 my $sas_url = URI->new($endpoint);
54 11 my $sas_token = $sas_url->query;
55 11 ▶ croak 'Blob SAS URL cannot be combined with a credential'
Branch: 1 branch
BranchTrueFalseTotal
if defined $sas_token and defined $credential 1 10 11
Condition100%3/3
defined $sas_token and defined $credential
!ll&&!rl&&r
281
MC/DC100%2/2
defined $sas_token and defined $credential
defined $sas_token defined $credential
Truth table100%3/3
A and B
A= defined $sas_tokenB= defined $credential
ABresult
0X0
100
111
56 if defined $sas_token && defined $credential;
57 10 ▶ if (defined $sas_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sas_token) { } 8 2 10
58 8 $sas_url->query(undef);
59 8 $auth_credential = Azure::SDK::Core::Credential::Sas->new(token => $sas_token);
60 5 $endpoint = $sas_url->as_string;
61 }
62 else {
63 2 ▶ croak 'Blob endpoint requires a SAS credential'
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($credential) and $credential->isa("Azure::SDK::Core::Credential::Sas") 0 2 2
Condition33%1/3
builtin::blessed($credential) and $credential->isa("Azure::SDK::Core::Credential::Sas")
!ll&&!rl&&r
002
MC/DC0%0/2
builtin::blessed($credential) and $credential->isa("Azure::SDK::Core::Credential::Sas")
builtin::blessed($credential) $credential->isa("Azure::SDK::Core::Credential::Sas")
Truth table33%1/3
A and B
A= builtin::blessed($credential)B= $credential->isa("Azure::SDK::Core::Credential::Sas")
ABresult
0X0
100
111
64 unless blessed($credential)
65 && $credential->isa('Azure::SDK::Core::Credential::Sas');
66 2 $auth_credential = $credential;
67 }
68 7 $uri = Azure::SDK::Storage::Blobs::Uri->new(endpoint => $endpoint);
69 }
70 19 ▶ $auth_credential = $auth_credential->bound_to($uri->endpoint)
Branch: 1 branch
BranchTrueFalseTotal
if $auth_credential->isa("Azure::SDK::Core::Credential::Sas") 7 12 19
71 if $auth_credential->isa('Azure::SDK::Core::Credential::Sas');
72 18 $serializer = Azure::SDK::Storage::Blobs::Serializer->new;
73
74 18 ▶ my $base = $options // Azure::SDK::Core::ClientOptions->new;
Condition33%1/3
$options // "Azure::SDK::Core::ClientOptions"->new
l!l&&r!l&&!r
1800
MC/DC0%0/2
$options // "Azure::SDK::Core::ClientOptions"->new
$options "Azure::SDK::Core::ClientOptions"->new
Truth table33%1/3
A // B
A= $optionsB= "Azure::SDK::Core::ClientOptions"->new
ABresult
1X1
011
000
75 18 ▶ croak 'Azure::SDK::Storage::Blobs options must be ClientOptions'
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($base) and $base->isa("Azure::SDK::Core::ClientOptions") 0 18 18
Condition33%1/3
builtin::blessed($base) and $base->isa("Azure::SDK::Core::ClientOptions")
!ll&&!rl&&r
0018
MC/DC0%0/2
builtin::blessed($base) and $base->isa("Azure::SDK::Core::ClientOptions")
builtin::blessed($base) $base->isa("Azure::SDK::Core::ClientOptions")
Truth table33%1/3
A and B
A= builtin::blessed($base)B= $base->isa("Azure::SDK::Core::ClientOptions")
ABresult
0X0
100
111
76 unless blessed($base) && $base->isa('Azure::SDK::Core::ClientOptions');
77
78 18 my $client_options = Azure::SDK::Core::ClientOptions->new(
79 api_version => API_VERSION,
80 diagnostics_enabled => $base->diagnostics_enabled,
81 user_agent => $base->user_agent,
82 max_retries => $base->max_retries,
83 base_delay => $base->base_delay,
84 default_headers => {
85 'x-ms-version' => API_VERSION,
86 $base->default_headers->%*,
87 },
88 transport => $base->transport,
89 credential => $auth_credential,
90 logger => $base->logger,
91 max_response_bytes => $base->max_response_bytes,
92 per_call_policies => $base->per_call_policies,
93 per_try_policies => [ $base->per_try_policies->@*, @signers ],
94 );
95
96 18 $core = Azure::SDK::Core->new(
97 endpoint => $uri->endpoint,
98 options => $client_options,
99 );
100 }
101
102 6 ▶ method create_container ($container, %options) {
Subroutine create_container: called CC=7 SCAR=20.4
Pod documented
103 6 _reject_unknown_options( \%options, 'if_not_exists' );
104
105 6 my $target = $uri->for_container($container, { restype => 'container' });
106 my $request = Azure::SDK::Core::Request->new(
107 method => 'PUT',
108 url => $target->{url},
109 6 );
110
111 6 my $response = eval { $core->send($request) };
112 6 my $error = $@;
113
114 6 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 2 4 6
115 return undef
116 if $options{if_not_exists}
117 2 ▶ && blessed($error)
Branch: 1 branch
BranchTrueFalseTotal
if $options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq "ContainerAlreadyExists" 1 1 2
Condition45%5/11
$options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq "ContainerAlreadyExists"
!ll&&!rl&&r
011
$options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error")
!ll&&!rl&&r
002
$options{"if_not_exists"} and builtin::blessed($error)
!ll&&!rl&&r
002
$error->code // ""
l!l
20
MC/DC0%0/4
$options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq "ContainerAlreadyExists"
$options{"if_not_exists"} builtin::blessed($error) $error->isa("Azure::SDK::Core::Error") $error->code
Truth table20%1/5
A and B and C and D
A= $options{"if_not_exists"}B= builtin::blessed($error)C= $error->isa("Azure::SDK::Core::Error")D= $error->code
ABCDresult
0XXX0
10XX0
110X0
11100
11111
118 && $error->isa('Azure::SDK::Core::Error')
119 && ( $error->code // '' ) eq 'ContainerAlreadyExists';
120 1 die $error;
121 }
122
123 4 return $response;
124 }
125
126 1 ▶ method delete_container ($container, %options) {
Subroutine delete_container: called CC=2 SCAR=7.1
Pod documented
127 1 _reject_unknown_options( \%options, 'if_exists' );
128
129 1 my $target = $uri->for_container($container, { restype => 'container' });
130 return $self->_send(
131 method => 'DELETE',
132 target => $target,
133 1 ▶ ignored_code => $options{if_exists} ? 'ContainerNotFound' : undef,
Branch: 1 branch
BranchTrueFalseTotal
$options{'if_exists'} ? : 1 0 1
134 );
135 }
136
137 1 ▶ method upload_blob ($container, $blob, $body, %options) {
Subroutine upload_blob: called CC=11 SCAR=29.7
Pod documented
138 1 _reject_unknown_options( \%options, qw(content_type if_match overwrite) );
139 1 ▶ croak 'upload_blob requires a body'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $body and not ref $body 0 1 1
Condition33%1/3
defined $body and not ref $body
!ll&&!rl&&r
001
MC/DC0%0/2
defined $body and not ref $body
defined $body not ref $body
Truth table33%1/3
A and not(B)
A= defined $bodyB= not ref $body
ABresult
0X0
100
111
140 unless defined $body && !ref $body;
141
142 1 my $bytes = $body;
143 1 ▶ croak 'upload_blob body must be a byte string'
Branch: 1 branch
BranchTrueFalseTotal
unless utf8::downgrade($bytes, 1) 0 1 1
144 unless utf8::downgrade($bytes, 1);
145
146 croak 'upload_blob cannot combine if_match with overwrite => 0'
147 1 ▶ if defined $options{if_match} && exists $options{overwrite} && !$options{overwrite};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"if_match"} and exists $options{"overwrite"} and not $options{"overwrite"} 0 1 1
Condition33%2/6
defined $options{"if_match"} and exists $options{"overwrite"} and not $options{"overwrite"}
!ll&&!rl&&r
100
defined $options{"if_match"} and exists $options{"overwrite"}
!ll&&!rl&&r
100
MC/DC0%0/3
defined $options{"if_match"} and exists $options{"overwrite"} and not $options{"overwrite"}
defined $options{"if_match"} exists $options{"overwrite"} not $options{"overwrite"}
Truth table25%1/4
A and B and not(C)
A= defined $options{"if_match"}B= exists $options{"overwrite"}C= not $options{"overwrite"}
ABCresult
0XX0
10X0
1100
1111
148
149 1 my %headers = (
150 'Content-Length' => length($bytes),
151 'x-ms-blob-type' => 'BlockBlob',
152 );
153 $headers{'Content-Type'} = $options{content_type}
154 1 ▶ if defined $options{content_type};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"content_type"} 1 0 1
155 $headers{'If-Match'} = _strong_etag( $options{if_match} )
156 1 ▶ if defined $options{if_match};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"if_match"} 0 1 1
157 $headers{'If-None-Match'} = '*'
158 1 ▶ if exists $options{overwrite} && !$options{overwrite};
Branch: 1 branch
BranchTrueFalseTotal
if exists $options{"overwrite"} and not $options{"overwrite"} 1 0 1
Condition33%1/3
exists $options{"overwrite"} and not $options{"overwrite"}
!ll&&!rl&&r
001
MC/DC0%0/2
exists $options{"overwrite"} and not $options{"overwrite"}
exists $options{"overwrite"} not $options{"overwrite"}
Truth table33%1/3
A and not(B)
A= exists $options{"overwrite"}B= not $options{"overwrite"}
ABresult
0X0
100
111
159
160 1 return $self->_send(
161 method => 'PUT',
162 target => $uri->for_blob($container, $blob),
163 headers => \%headers,
164 body => $bytes,
165 );
166 }
167
168 6 ▶ method download_blob ($container, $blob, %options) {
Subroutine download_blob: called CC=2 SCAR=6.9
Pod documented
169 6 _reject_unknown_options( \%options, 'if_match' );
170
171 6 my %headers;
172 $headers{'If-Match'} = _strong_etag( $options{if_match} )
173 6 ▶ if defined $options{if_match};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"if_match"} 3 3 6
174
175 5 return $self->_send(
176 method => 'GET',
177 target => $uri->for_blob($container, $blob),
178 headers => \%headers,
179 );
180 }
181
182 1 ▶ method get_blob_properties ($container, $blob, %options) {
Subroutine get_blob_properties: called CC=2 SCAR=7.0
Pod documented
183 1 _reject_unknown_options( \%options, 'if_match' );
184
185 1 my %headers;
186 $headers{'If-Match'} = _strong_etag( $options{if_match} )
187 1 ▶ if defined $options{if_match};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"if_match"} 0 1 1
188
189 1 return $self->_send(
190 method => 'HEAD',
191 target => $uri->for_blob($container, $blob),
192 headers => \%headers,
193 );
194 }
195
196 1 ▶ method delete_blob ($container, $blob, %options) {
Subroutine delete_blob: called CC=3 SCAR=11.4
Pod documented
197 1 _reject_unknown_options( \%options, qw(if_exists if_match) );
198
199 1 my %headers;
200 $headers{'If-Match'} = _strong_etag( $options{if_match} )
201 1 ▶ if defined $options{if_match};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"if_match"} 0 1 1
202
203 return $self->_send(
204 method => 'DELETE',
205 target => $uri->for_blob($container, $blob),
206 headers => \%headers,
207 1 ▶ ignored_code => $options{if_exists} ? 'BlobNotFound' : undef,
Branch: 1 branch
BranchTrueFalseTotal
$options{'if_exists'} ? : 1 0 1
208 );
209 }
210
211 7 ▶ method list_blobs ($container, %options) {
Subroutine list_blobs: called CC=6 SCAR=18.1
Pod documented
212 7 _reject_unknown_options( \%options, qw(marker max_results prefix) );
213
214 7 my %query = (
215 restype => 'container',
216 comp => 'list',
217 );
218 7 ▶ $query{marker} = $options{marker} if defined $options{marker};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"marker"} 5 2 7
219 7 ▶ $query{prefix} = $options{prefix} if defined $options{prefix};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"prefix"} 5 2 7
220 7 ▶ if (defined $options{max_results}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"max_results"}) 5 2 7
221 croak 'list_blobs max_results must be a positive integer'
222 5 ▶ unless $options{max_results} =~ /\A[0-9]+\z/ && $options{max_results} > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $options{"max_results"} =~ /\A[0-9]+\z/u and $options{"max_results"} > 0 0 5 5
Condition33%1/3
$options{"max_results"} =~ /\A[0-9]+\z/u and $options{"max_results"} > 0
!ll&&!rl&&r
005
MC/DC0%0/2
$options{"max_results"} =~ /\A[0-9]+\z/u and $options{"max_results"} > 0
$options{"max_results"} =~ /\A[0-9]+\z/u $options{"max_results"} > 0
Truth table33%1/3
A and B
A= $options{"max_results"} =~ /\A[0-9]+\z/uB= $options{"max_results"} > 0
ABresult
0X0
100
111
223 5 $query{maxresults} = $options{max_results};
224 }
225
226 7 my $response = $self->_send(
227 method => 'GET',
228 target => $uri->for_container($container, \%query),
229 );
230
231 7 return $serializer->parse_blob_list( $response->body );
232 }
233
234 1 ▶ method list_blobs_pager ($container, %options) {
Subroutine list_blobs_pager: called CC=1 SCAR=0.0
Pod documented
235 1 _reject_unknown_options( \%options, qw(marker max_results prefix) );
236
237 1 my $continuation_token = delete $options{marker};
238 return Azure::SDK::Core::Pager->new(
239 continuation_token => $continuation_token,
240 2 ▶ fetch_page => sub ($token) {
Subroutine __ANON__: called CC=2 SCAR=7.1
241 2 my %page_options = %options;
242 2 ▶ $page_options{marker} = $token if defined $token;
Branch: 1 branch
BranchTrueFalseTotal
if defined $token 2 0 2
243 2 return $self->list_blobs($container, %page_options);
244 },
245 1 );
246 }
247
248 2 ▶ method list_all_blobs ($container, %options) {
Subroutine list_all_blobs: called CC=3 SCAR=11.0
Pod documented
249 2 _reject_unknown_options( \%options, qw(marker max_results prefix) );
250
251 2 my @items;
252 my %seen_markers;
253
254 2 while (1) {
255 4 my $page = $self->list_blobs($container, %options);
256 4 push @items, $page->items->@*;
257 4 ▶ last unless $page->has_more;
Branch: 1 branch
BranchTrueFalseTotal
unless $page->has_more 1 3 4
258
259 3 my $marker = $page->next_marker;
260 croak 'Blob listing returned a repeated continuation marker'
261 3 ▶ if $seen_markers{$marker}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen_markers{$marker}++ 1 2 3
262 2 $options{marker} = $marker;
263 }
264
265 1 return \@items;
266 }
267
268 16 ▶ method _send (%args) {
Subroutine _send: called CC=8 SCAR=21.1
269 my $request = Azure::SDK::Core::Request->new(
270 method => $args{method},
271 url => $args{target}{url},
272 headers => $args{headers} // {},
273 body => $args{body},
274 16 ▶ );
Condition100%2/2
$args{"headers"} // {}
l!l
88
MC/DC100%1/1
$args{"headers"} // {}
$args{"headers"}
Truth table100%2/2
A
A= $args{"headers"}
Aresult
11
00
275
276 16 my $response = eval { $core->send($request) };
277 16 my $error = $@;
278 16 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 6 10 16
279 return undef
280 if defined $args{ignored_code}
281 && blessed($error)
282 && $error->isa('Azure::SDK::Core::Error')
283 6 ▶ && ( $error->code // '' ) eq $args{ignored_code};
Branch: 1 branch
BranchTrueFalseTotal
if defined $args{"ignored_code"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq $args{"ignored_code"} 2 4 6
Condition63%7/11
defined $args{"ignored_code"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq $args{"ignored_code"}
!ll&&!rl&&r
402
defined $args{"ignored_code"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error")
!ll&&!rl&&r
402
defined $args{"ignored_code"} and builtin::blessed($error)
!ll&&!rl&&r
402
$error->code // ""
l!l
20
MC/DC25%1/4
defined $args{"ignored_code"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq $args{"ignored_code"}
defined $args{"ignored_code"} builtin::blessed($error) $error->isa("Azure::SDK::Core::Error") $error->code
Truth table40%2/5
A and B and C and D
A= defined $args{"ignored_code"}B= builtin::blessed($error)C= $error->isa("Azure::SDK::Core::Error")D= $error->code
ABCDresult
0XXX0
10XX0
110X0
11100
11111
284 4 die $error;
285 }
286
287 10 return $response;
288 }
289
290 26 ▶ sub _reject_unknown_options ( $options, @allowed ) {
Subroutine _reject_unknown_options: called CC=2 SCAR=7.0
291 26 my %allowed = map { $_ => 1 } @allowed;
292 26 my @unknown = sort grep { !$allowed{$_} } keys %{$options};
293 26 ▶ croak 'Unknown Blob operation option(s): ' . join( ', ', @unknown )
Branch: 1 branch
BranchTrueFalseTotal
if @unknown 0 26 26
294 if @unknown;
295 }
296
297 3 ▶ sub _strong_etag ($value) {
Subroutine _strong_etag: called CC=10 SCAR=24.9
298 3 my ($etag, $is_weak);
299
300 3 ▶ if (blessed($value) && $value->isa('Azure::SDK::Storage::Blobs::BlobItem')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($value) and $value->isa('Azure::SDK::Storage::Blobs::BlobItem')) { } 1 2 3
Condition66%2/3
builtin::blessed($value) and $value->isa("Azure::SDK::Storage::Blobs::BlobItem")
!ll&&!rl&&r
201
MC/DC50%1/2
builtin::blessed($value) and $value->isa("Azure::SDK::Storage::Blobs::BlobItem")
builtin::blessed($value) $value->isa("Azure::SDK::Storage::Blobs::BlobItem")
Truth table66%2/3
A and B
A= builtin::blessed($value)B= $value->isa("Azure::SDK::Storage::Blobs::BlobItem")
ABresult
0X0
100
111
301 1 $etag = $value->etag;
302 1 $is_weak = $value->etag_is_weak;
303 }
304 else {
305 2 ▶ croak 'if_match must be an ETag string or BlobItem'
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 0 2 2
306 if ref $value;
307 2 $etag = $value;
308 2 ▶ $is_weak = defined $etag && $etag =~ s/\AW\///i;
Condition33%1/3
defined $etag && $etag =~ s[\AW/][]iu
!ll&&!rl&&r
020
MC/DC0%0/2
defined $etag && $etag =~ s[\AW/][]iu
defined $etag $etag =~ s[\AW/][]iu
Truth table33%1/3
A && B
A= defined $etagB= $etag =~ s[\AW/][]iu
ABresult
0X0
100
111
309 2 ▶ $etag =~ s/\A"|"\z//g if defined $etag;
Branch: 1 branch
BranchTrueFalseTotal
if defined $etag 2 0 2
310 }
311
312 3 ▶ croak 'if_match requires a strong ETag'
Branch: 1 branch
BranchTrueFalseTotal
if $is_weak 1 2 3
313 if $is_weak;
314 2 ▶ croak 'if_match requires a non-empty ETag'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $etag and length $etag 0 2 2
Condition33%1/3
defined $etag and length $etag
!ll&&!rl&&r
002
MC/DC0%0/2
defined $etag and length $etag
defined $etag length $etag
Truth table33%1/3
A and B
A= defined $etagB= length $etag
ABresult
0X0
100
111
315 unless defined $etag && length $etag;
316 2 ▶ croak 'if_match ETag must not contain control characters or quotes'
Branch: 1 branch
BranchTrueFalseTotal
if $etag =~ /[\x00-\x1f\x7f"]/u 0 2 2
317 if $etag =~ /[\x00-\x1f\x7f"]/;
318
319 2 return qq{"$etag"};
320 }
321 }
322
323 2 1;
324
325 __END__
« SDK/Storage/Tables/Entity.pm ↑ Summary SDK/Storage/Tables.pm »