SDK/Storage/Queues.pm

filter: Statementstmt 100% 202 / 202 Branchbran 89.0% 73 / 82 Conditioncond 64.4% 58 / 90 MC/DCmcdc 34.0% 15 / 44 Subroutinesub 100% 37 / 37 Podpod 0.0% 0 / 13 totaltotal 82.2% 385 / 468 CC 74 SCAR 21.3
CC
74
Cov
89%
__ANON__
22.9
send_message
11.6
_metadata_headers
9.1
CRAP 8.4
« SDK/Storage/Tables/Transaction.pm ↑ Summary SDK/AppConfiguration.pm »
1 3 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 3 ▶use Azure::SDK::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Azure::SDK::Core::ClientOptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Azure::SDK::Core::Pager;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Azure::SDK::Core::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Azure::SDK::Core::Credential::Sas;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Azure::SDK::Storage::Queues::ConnectionString;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Azure::SDK::Storage::Queues::Message;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Azure::SDK::Storage::Queues::QueueProperties;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use Azure::SDK::Storage::Queues::Serializer;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Azure::SDK::Storage::Queues::SharedKey;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use Azure::SDK::Storage::Queues::Uri;
Subroutine BEGIN: called CC=1 SCAR=0.0
16
17 3 class Azure::SDK::Storage::Queues {
18 3 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶ use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 3 ▶ use URI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
21
22 3 ▶ use constant API_VERSION => '2025-11-05';
Subroutine BEGIN: called CC=1 SCAR=0.0
23
24 3 field $connection_string :param = undef;
25 3 field $endpoint :param = undef;
26 3 field $credential :param = undef;
27 3 field $options :param = undef;
28
29 3 field $connection :reader = undef;
30 3 field $uri :reader = undef;
31 3 field $serializer :reader = undef;
32 3 field $core :reader = undef;
33
34 31 ▶ ADJUST {
Subroutine __ANON__: called CC=19 SCAR=31.3
35 31 ▶ croak 'Queue connection_string cannot be combined with endpoint or credential'
Branch: 1 branch
BranchTrueFalseTotal
if defined $connection_string and defined $endpoint || defined $credential 1 30 31
Condition83%5/6
defined $connection_string and defined $endpoint || defined $credential
!ll&&!rl&&r
11191
defined $endpoint or defined $credential
l!l&&r!l&&!r
1019
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
36 if defined $connection_string && (defined $endpoint || defined $credential);
37
38 30 my $auth_credential;
39 my @signers;
40 30 ▶ if (defined $connection_string) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $connection_string) { } 19 11 30
41 19 ▶ $connection = blessed($connection_string)
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($connection_string) && $connection_string->isa('Azure::SDK::Storage::Queues::ConnectionString') ? : 0 19 19
Condition33%1/3
builtin::blessed($connection_string) and $connection_string->isa("Azure::SDK::Storage::Queues::ConnectionString")
!ll&&!rl&&r
1900
MC/DC0%0/2
builtin::blessed($connection_string) and $connection_string->isa("Azure::SDK::Storage::Queues::ConnectionString")
builtin::blessed($connection_string) $connection_string->isa("Azure::SDK::Storage::Queues::ConnectionString")
Truth table33%1/3
A and B
A= builtin::blessed($connection_string)B= $connection_string->isa("Azure::SDK::Storage::Queues::ConnectionString")
ABresult
0X0
100
111
42 && $connection_string->isa('Azure::SDK::Storage::Queues::ConnectionString')
43 ? $connection_string
44 : Azure::SDK::Storage::Queues::ConnectionString->parse($connection_string);
45 16 $uri = Azure::SDK::Storage::Queues::Uri->from_connection_string($connection);
46 16 $auth_credential = $connection->credential;
47 16 ▶ push @signers, Azure::SDK::Storage::Queues::SharedKey->new(
Branch: 1 branch
BranchTrueFalseTotal
if $auth_credential->isa("Azure::SDK::Core::Credential::SharedKey") 14 2 16
48 credential => $auth_credential,
49 api_version => API_VERSION,
50 ) if $auth_credential->isa('Azure::SDK::Core::Credential::SharedKey');
51 }
52 else {
53 11 ▶ croak 'Queue 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
54 unless defined $endpoint && length $endpoint;
55 11 my $sas_url = URI->new($endpoint);
56 11 my $sas_token = $sas_url->query;
57 11 ▶ croak 'Queue 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
58 if defined $sas_token && defined $credential;
59 10 ▶ if (defined $sas_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sas_token) { } 8 2 10
60 8 $sas_url->query(undef);
61 8 $auth_credential = Azure::SDK::Core::Credential::Sas->new(token => $sas_token);
62 5 $endpoint = $sas_url->as_string;
63 }
64 else {
65 2 ▶ croak 'Queue 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
66 unless blessed($credential)
67 && $credential->isa('Azure::SDK::Core::Credential::Sas');
68 2 $auth_credential = $credential;
69 }
70 7 $uri = Azure::SDK::Storage::Queues::Uri->new(endpoint => $endpoint);
71 }
72 21 ▶ $auth_credential = $auth_credential->bound_to($uri->endpoint)
Branch: 1 branch
BranchTrueFalseTotal
if $auth_credential->isa("Azure::SDK::Core::Credential::Sas") 7 14 21
73 if $auth_credential->isa('Azure::SDK::Core::Credential::Sas');
74 20 $serializer = Azure::SDK::Storage::Queues::Serializer->new;
75
76 20 ▶ my $base = $options // Azure::SDK::Core::ClientOptions->new;
Condition33%1/3
$options // "Azure::SDK::Core::ClientOptions"->new
l!l&&r!l&&!r
2000
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
77 20 ▶ croak 'Azure::SDK::Storage::Queues options must be ClientOptions'
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($base) and $base->isa("Azure::SDK::Core::ClientOptions") 0 20 20
Condition33%1/3
builtin::blessed($base) and $base->isa("Azure::SDK::Core::ClientOptions")
!ll&&!rl&&r
0020
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
78 unless blessed($base) && $base->isa('Azure::SDK::Core::ClientOptions');
79
80 20 my $client_options = Azure::SDK::Core::ClientOptions->new(
81 api_version => API_VERSION,
82 diagnostics_enabled => $base->diagnostics_enabled,
83 user_agent => $base->user_agent,
84 max_retries => $base->max_retries,
85 base_delay => $base->base_delay,
86 default_headers => {
87 'x-ms-version' => API_VERSION,
88 $base->default_headers->%*,
89 },
90 transport => $base->transport,
91 credential => $auth_credential,
92 logger => $base->logger,
93 max_response_bytes => $base->max_response_bytes,
94 per_call_policies => $base->per_call_policies,
95 per_try_policies => [ $base->per_try_policies->@*, @signers ],
96 );
97
98 20 $core = Azure::SDK::Core->new(
99 endpoint => $uri->endpoint,
100 options => $client_options,
101 );
102 }
103
104 9 ▶ method create_queue ($queue, %options) {
Subroutine create_queue: called CC=7 SCAR=19.8
Pod undocumented
105 9 _reject_unknown_options(\%options, qw(if_not_exists metadata));
106 8 my $headers = _metadata_headers($options{metadata});
107
108 6 my $response = eval {
109 6 $self->_send(
110 method => 'PUT',
111 target => $uri->for_queue($queue),
112 headers => $headers,
113 );
114 };
115 6 my $error = $@;
116 6 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 2 4 6
117 return undef
118 if $options{if_not_exists}
119 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 "QueueAlreadyExists" 1 1 2
Condition63%7/11
$options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq "QueueAlreadyExists"
!ll&&!rl&&r
101
$options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error")
!ll&&!rl&&r
101
$options{"if_not_exists"} and builtin::blessed($error)
!ll&&!rl&&r
101
$error->code // ""
l!l
10
MC/DC25%1/4
$options{"if_not_exists"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error") and ($error->code // "") eq "QueueAlreadyExists"
$options{"if_not_exists"} builtin::blessed($error) $error->isa("Azure::SDK::Core::Error") $error->code
Truth table40%2/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
120 && $error->isa('Azure::SDK::Core::Error')
121 && ($error->code // '') eq 'QueueAlreadyExists';
122 1 die $error;
123 }
124
125 4 return $response;
126 }
127
128 5 ▶ method delete_queue ($queue, %options) {
Subroutine delete_queue: called CC=2 SCAR=6.9
Pod undocumented
129 5 _reject_unknown_options(\%options, 'if_exists');
130 return $self->_send(
131 method => 'DELETE',
132 target => $uri->for_queue($queue),
133 5 ▶ ignored_code => $options{if_exists} ? 'QueueNotFound' : undef,
Branch: 1 branch
BranchTrueFalseTotal
$options{'if_exists'} ? : 4 1 5
134 );
135 }
136
137 3 ▶ method get_queue_properties ($queue) {
Subroutine get_queue_properties: called CC=1 SCAR=0.0
Pod undocumented
138 3 my $response = $self->_send(
139 method => 'GET',
140 target => $uri->for_queue($queue, { comp => 'metadata' }),
141 );
142
143 3 my $headers = $response->headers;
144 my %metadata = map {
145 2 substr($_, length 'x-ms-meta-') => $headers->{$_}
146 3 } grep { index($_, 'x-ms-meta-') == 0 } keys %{$headers};
147
148 3 return Azure::SDK::Storage::Queues::QueueProperties->new(
149 approximate_message_count => $response->header('x-ms-approximate-messages-count'),
150 metadata => \%metadata,
151 );
152 }
153
154 4 ▶ method set_queue_metadata ($queue, $metadata) {
Subroutine set_queue_metadata: called CC=1 SCAR=0.0
Pod undocumented
155 4 return $self->_send(
156 method => 'PUT',
157 target => $uri->for_queue($queue, { comp => 'metadata' }),
158 headers => _metadata_headers($metadata),
159 );
160 }
161
162 6 ▶ method list_queues (%options) {
Subroutine list_queues: called CC=5 SCAR=16.1
Pod undocumented
163 6 _reject_unknown_options(
164 \%options,
165 qw(include_metadata marker max_results prefix),
166 );
167
168 6 my %query = (comp => 'list');
169 6 ▶ $query{marker} = $options{marker} if defined $options{marker};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"marker"} 3 3 6
170 6 ▶ $query{prefix} = $options{prefix} if defined $options{prefix};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options{"prefix"} 2 4 6
171 6 ▶ $query{include} = 'metadata' if $options{include_metadata};
Branch: 1 branch
BranchTrueFalseTotal
if $options{"include_metadata"} 2 4 6
172 6 ▶ if (defined $options{max_results}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"max_results"}) 6 0 6
173 _integer_between(
174 'list_queues max_results',
175 $options{max_results},
176 6 1,
177 5000,
178 );
179 4 $query{maxresults} = $options{max_results};
180 }
181
182 4 my $response = $self->_send(
183 method => 'GET',
184 target => $uri->for_service(\%query),
185 );
186 4 return $serializer->parse_queue_list($response->body);
187 }
188
189 2 ▶ method list_queues_pager (%options) {
Subroutine list_queues_pager: called CC=1 SCAR=0.0
Pod undocumented
190 2 _reject_unknown_options(
191 \%options,
192 qw(include_metadata marker max_results prefix),
193 );
194
195 2 my $continuation_token = delete $options{marker};
196 return Azure::SDK::Core::Pager->new(
197 continuation_token => $continuation_token,
198 4 ▶ fetch_page => sub ($token) {
Subroutine __ANON__: called CC=2 SCAR=6.9
199 4 my %page_options = %options;
200 4 ▶ $page_options{marker} = $token if defined $token;
Branch: 1 branch
BranchTrueFalseTotal
if defined $token 3 1 4
201 4 return $self->list_queues(%page_options);
202 },
203 2 );
204 }
205
206 1 ▶ method list_all_queues (%options) {
Subroutine list_all_queues: called CC=2 SCAR=6.9
Pod undocumented
207 1 my $pager = $self->list_queues_pager(%options);
208 1 my @items;
209 1 ▶ while (defined(my $item = $pager->next_item)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $item = $pager->next_item)) 2 1 3
210 2 push @items, $item;
211 }
212 1 return \@items;
213 }
214
215 4 ▶ method send_message ($queue, $message_text, %options) {
Subroutine send_message: called CC=11 SCAR=24.5
Pod undocumented
216 4 _reject_unknown_options(\%options, qw(message_ttl visibility_timeout));
217
218 4 my %query;
219 4 ▶ if (defined $options{visibility_timeout}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"visibility_timeout"}) 3 1 4
220 _integer_between(
221 'send_message visibility_timeout',
222 $options{visibility_timeout},
223 3 0,
224 604800,
225 );
226 2 $query{visibilitytimeout} = $options{visibility_timeout};
227 }
228 3 ▶ if (defined $options{message_ttl}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"message_ttl"}) 3 0 3
229 croak 'send_message message_ttl must be -1 or a positive integer'
230 unless $options{message_ttl} eq '-1'
231 3 ▶ || ($options{message_ttl} =~ /\A[0-9]+\z/ && $options{message_ttl} > 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $options{"message_ttl"} eq -1 or $options{"message_ttl"} =~ /\A[0-9]+\z/u and $options{"message_ttl"} > 0 1 2 3
Condition83%5/6
$options{"message_ttl"} eq -1 or $options{"message_ttl"} =~ /\A[0-9]+\z/u and $options{"message_ttl"} > 0
l!l&&r!l&&!r
111
$options{"message_ttl"} =~ /\A[0-9]+\z/u and $options{"message_ttl"} > 0
!ll&&!rl&&r
011
MC/DC66%2/3
$options{"message_ttl"} eq -1 or $options{"message_ttl"} =~ /\A[0-9]+\z/u and $options{"message_ttl"} > 0
$options{"message_ttl"} eq -1 $options{"message_ttl"} =~ /\A[0-9]+\z/u $options{"message_ttl"} > 0
Truth table75%3/4
A or B and C
A= $options{"message_ttl"} eq -1B= $options{"message_ttl"} =~ /\A[0-9]+\z/uC= $options{"message_ttl"} > 0
ABCresult
1XX1
0111
00X0
0100
232 2 $query{messagettl} = $options{message_ttl};
233 }
234 2 ▶ if (defined $options{visibility_timeout}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"visibility_timeout"} and defined $options{"message_ttl"} and $options{"message_ttl"} != -1 and $options{"visibility_timeout"} >= $options{"message_ttl"}) 1 1 2
Condition55%5/9
defined $options{"visibility_timeout"} and defined $options{"message_ttl"} and $options{"message_ttl"} != -1 and $options{"visibility_timeout"} >= $options{"message_ttl"}
!ll&&!rl&&r
101
defined $options{"visibility_timeout"} and defined $options{"message_ttl"} and $options{"message_ttl"} != -1
!ll&&!rl&&r
011
defined $options{"visibility_timeout"} and defined $options{"message_ttl"}
!ll&&!rl&&r
002
MC/DC25%1/4
defined $options{"visibility_timeout"} and defined $options{"message_ttl"} and $options{"message_ttl"} != -1 and $options{"visibility_timeout"} >= $options{"message_ttl"}
defined $options{"visibility_timeout"} defined $options{"message_ttl"} $options{"message_ttl"} != -1 $options{"visibility_timeout"} >= $options{"message_ttl"}
Truth table40%2/5
A and B and C and D
A= defined $options{"visibility_timeout"}B= defined $options{"message_ttl"}C= $options{"message_ttl"} != -1D= $options{"visibility_timeout"} >= $options{"message_ttl"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
235 && defined $options{message_ttl}
236 && $options{message_ttl} != -1
237 && $options{visibility_timeout} >= $options{message_ttl}) {
238 1 croak 'send_message visibility_timeout must be less than message_ttl';
239 }
240
241 1 my $body = $serializer->serialize_message($message_text);
242 1 my $response = $self->_send(
243 method => 'POST',
244 target => $uri->for_messages($queue, \%query),
245 headers => {
246 'Content-Length' => length($body),
247 'Content-Type' => 'application/xml; charset=utf-8',
248 },
249 body => $body,
250 );
251 1 my $messages = $serializer->parse_messages($response->body);
252 croak 'Queue send response did not contain a message receipt'
253 1 ▶ unless @{$messages};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$messages;} 0 1 1
254 1 return $messages->[0];
255 }
256
257 4 ▶ method receive_messages ($queue, %options) {
Subroutine receive_messages: called CC=3 SCAR=11.0
Pod undocumented
258 4 _reject_unknown_options(\%options, qw(max_messages visibility_timeout));
259
260 4 my %query;
261 4 ▶ if (defined $options{max_messages}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"max_messages"}) 2 2 4
262 _integer_between(
263 'receive_messages max_messages',
264 $options{max_messages},
265 2 1,
266 32,
267 );
268 1 $query{numofmessages} = $options{max_messages};
269 }
270 3 ▶ if (defined $options{visibility_timeout}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"visibility_timeout"}) 2 1 3
271 _integer_between(
272 'receive_messages visibility_timeout',
273 $options{visibility_timeout},
274 2 1,
275 604800,
276 );
277 1 $query{visibilitytimeout} = $options{visibility_timeout};
278 }
279
280 2 my $response = $self->_send(
281 method => 'GET',
282 target => $uri->for_messages($queue, \%query),
283 );
284 1 return $serializer->parse_messages($response->body);
285 }
286
287 5 ▶ method peek_messages ($queue, %options) {
Subroutine peek_messages: called CC=2 SCAR=6.9
Pod undocumented
288 5 _reject_unknown_options(\%options, 'max_messages');
289
290 5 my %query = (peekonly => 'true');
291 5 ▶ if (defined $options{max_messages}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options{"max_messages"}) 2 3 5
292 _integer_between(
293 'peek_messages max_messages',
294 $options{max_messages},
295 2 1,
296 32,
297 );
298 1 $query{numofmessages} = $options{max_messages};
299 }
300
301 4 my $response = $self->_send(
302 method => 'GET',
303 target => $uri->for_messages($queue, \%query),
304 );
305 1 return $serializer->parse_messages($response->body);
306 }
307
308 4 ▶ method update_message ($queue, $message_id, $pop_receipt, %options) {
Subroutine update_message: called CC=6 SCAR=18.1
Pod undocumented
309 4 _reject_unknown_options(\%options, qw(message_text visibility_timeout));
310 4 ▶ croak 'update_message requires a pop_receipt'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pop_receipt and not ref $pop_receipt and length $pop_receipt 1 3 4
Condition66%4/6
defined $pop_receipt and not ref $pop_receipt and length $pop_receipt
!ll&&!rl&&r
103
defined $pop_receipt and not ref $pop_receipt
!ll&&!rl&&r
103
MC/DC33%1/3
defined $pop_receipt and not ref $pop_receipt and length $pop_receipt
defined $pop_receipt not ref $pop_receipt length $pop_receipt
Truth table50%2/4
A and not(B) and C
A= defined $pop_receiptB= not ref $pop_receiptC= length $pop_receipt
ABCresult
0XX0
10X0
1100
1111
311 unless defined $pop_receipt && !ref $pop_receipt && length $pop_receipt;
312 croak 'update_message requires visibility_timeout'
313 3 ▶ unless defined $options{visibility_timeout};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $options{"visibility_timeout"} 1 2 3
314 _integer_between(
315 'update_message visibility_timeout',
316 $options{visibility_timeout},
317 2 0,
318 604800,
319 );
320
321 1 my ($body, %headers);
322 1 ▶ if (exists $options{message_text}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options{"message_text"}) 1 0 1
323 1 $body = $serializer->serialize_message($options{message_text});
324 1 %headers = (
325 'Content-Length' => length($body),
326 'Content-Type' => 'application/xml; charset=utf-8',
327 );
328 }
329
330 my $response = $self->_send(
331 method => 'PUT',
332 target => $uri->for_message(
333 $queue,
334 $message_id,
335 {
336 popreceipt => $pop_receipt,
337 visibilitytimeout => $options{visibility_timeout},
338 },
339 1 ),
340 headers => \%headers,
341 body => $body,
342 );
343
344 return Azure::SDK::Storage::Queues::Message->new(
345 message_id => $message_id,
346 message_text => $options{message_text},
347 1 pop_receipt => $response->header('x-ms-popreceipt'),
348 time_next_visible => $response->header('x-ms-time-next-visible'),
349 );
350 }
351
352 2 ▶ method delete_message ($queue, $message_id, $pop_receipt) {
Subroutine delete_message: called CC=4 SCAR=14.2
Pod undocumented
353 2 ▶ croak 'delete_message requires a pop_receipt'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pop_receipt and not ref $pop_receipt and length $pop_receipt 1 1 2
Condition66%4/6
defined $pop_receipt and not ref $pop_receipt and length $pop_receipt
!ll&&!rl&&r
101
defined $pop_receipt and not ref $pop_receipt
!ll&&!rl&&r
101
MC/DC33%1/3
defined $pop_receipt and not ref $pop_receipt and length $pop_receipt
defined $pop_receipt not ref $pop_receipt length $pop_receipt
Truth table50%2/4
A and not(B) and C
A= defined $pop_receiptB= not ref $pop_receiptC= length $pop_receipt
ABCresult
0XX0
10X0
1100
1111
354 unless defined $pop_receipt && !ref $pop_receipt && length $pop_receipt;
355 1 return $self->_send(
356 method => 'DELETE',
357 target => $uri->for_message(
358 $queue,
359 $message_id,
360 { popreceipt => $pop_receipt },
361 ),
362 );
363 }
364
365 1 ▶ method clear_messages ($queue) {
Subroutine clear_messages: called CC=1 SCAR=0.0
Pod undocumented
366 1 return $self->_send(
367 method => 'DELETE',
368 target => $uri->for_messages($queue),
369 );
370 }
371
372 30 ▶ method _send (%args) {
Subroutine _send: called CC=8 SCAR=20.9
373 my $request = Azure::SDK::Core::Request->new(
374 method => $args{method},
375 url => $args{target}{url},
376 headers => $args{headers} // {},
377 body => $args{body},
378 30 ▶ );
Condition100%2/2
$args{"headers"} // {}
l!l
1020
MC/DC100%1/1
$args{"headers"} // {}
$args{"headers"}
Truth table100%2/2
A
A= $args{"headers"}
Aresult
11
00
379
380 30 my $response = eval { $core->send($request) };
381 30 my $error = $@;
382 30 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 9 21 30
383 return undef
384 if defined $args{ignored_code}
385 && blessed($error)
386 && $error->isa('Azure::SDK::Core::Error')
387 9 ▶ && ($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 7 9
Condition72%8/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
612
defined $args{"ignored_code"} and builtin::blessed($error) and $error->isa("Azure::SDK::Core::Error")
!ll&&!rl&&r
603
defined $args{"ignored_code"} and builtin::blessed($error)
!ll&&!rl&&r
603
$error->code // ""
l!l
30
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
388 7 die $error;
389 }
390 21 return $response;
391 }
392
393 12 ▶ sub _metadata_headers ($metadata) {
Subroutine _metadata_headers: called CC=9 SCAR=22.1
394 12 ▶ return {} unless defined $metadata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $metadata 5 7 12
395 7 ▶ croak 'Queue metadata must be a hash reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $metadata eq "HASH" 1 6 7
396 unless ref $metadata eq 'HASH';
397
398 6 my %headers;
399 6 for my $name (keys %{$metadata}) {
400 8 ▶ croak 'Queue metadata name must be an ASCII identifier'
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/u 1 7 8
401 unless $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/;
402 7 my $normalized_name = lc $name;
403 croak "Queue metadata repeats '$normalized_name'"
404 7 ▶ if exists $headers{"x-ms-meta-$normalized_name"};
Branch: 1 branch
BranchTrueFalseTotal
if exists $headers{"x-ms-meta-$normalized_name"} 1 6 7
405 6 my $value = $metadata->{$name};
406 6 ▶ croak "Queue metadata value for '$name' must be a scalar"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $value or ref $value 0 6 6
Condition33%1/3
not defined $value or ref $value
l!l&&r!l&&!r
006
MC/DC0%0/2
not defined $value or ref $value
not defined $value ref $value
Truth table33%1/3
not(A) or B
A= not defined $valueB= ref $value
ABresult
1X1
011
000
407 if !defined $value || ref $value;
408 6 ▶ croak "Queue metadata value for '$name' must not contain control characters"
Branch: 1 branch
BranchTrueFalseTotal
if $value =~ /[\x00-\x1f\x7f]/u 1 5 6
409 if $value =~ /[\x00-\x1f\x7f]/;
410 5 $headers{"x-ms-meta-$normalized_name"} = "$value";
411 }
412 3 return \%headers;
413 }
414
415 17 ▶ sub _integer_between ( $label, $value, $minimum, $maximum ) {
Subroutine _integer_between: called CC=6 SCAR=18.3
416 17 ▶ croak "$label must be between $minimum and $maximum"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value and not ref $value and $value =~ /\A[0-9]+\z/u and $value >= $minimum and $value <= $maximum 7 10 17
Condition75%9/12
defined $value and not ref $value and $value =~ /\A[0-9]+\z/u and $value >= $minimum and $value <= $maximum
!ll&&!rl&&r
4310
defined $value and not ref $value and $value =~ /\A[0-9]+\z/u and $value >= $minimum
!ll&&!rl&&r
1313
defined $value and not ref $value and $value =~ /\A[0-9]+\z/u
!ll&&!rl&&r
0116
defined $value and not ref $value
!ll&&!rl&&r
0017
MC/DC60%3/5
defined $value and not ref $value and $value =~ /\A[0-9]+\z/u and $value >= $minimum and $value <= $maximum
defined $value not ref $value $value =~ /\A[0-9]+\z/u $value >= $minimum $value <= $maximum
Truth table66%4/6
A and not(B) and C and D and E
A= defined $valueB= not ref $valueC= $value =~ /\A[0-9]+\z/uD= $value >= $minimumE= $value <= $maximum
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
417 unless defined $value
418 && !ref $value
419 && $value =~ /\A[0-9]+\z/
420 && $value >= $minimum
421 && $value <= $maximum;
422 10 return 0 + $value;
423 }
424
425 39 ▶ sub _reject_unknown_options ( $options, @allowed ) {
Subroutine _reject_unknown_options: called CC=2 SCAR=6.9
426 39 my %allowed = map { $_ => 1 } @allowed;
427 39 my @unknown = sort grep { !$allowed{$_} } keys %{$options};
428 39 ▶ croak 'Unknown Queue operation option(s): ' . join(', ', @unknown)
Branch: 1 branch
BranchTrueFalseTotal
if @unknown 1 38 39
429 if @unknown;
430 }
431 }
432
433 3 1;
434
435 __END__
« SDK/Storage/Tables/Transaction.pm ↑ Summary SDK/AppConfiguration.pm »