| 1 | 10 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 10 | ▶ | use feature 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 10 | ▶ | no warnings 'experimental::class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 10 | ▶ | use Azure::SDK::Core::ClientOptions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use Azure::SDK::Core::Context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Azure::SDK::Core::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 10 | ▶ | use Azure::SDK::Core::Request; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use XML::LibXML (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 10 | class Azure::SDK::Core { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | use bytes (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | ▶ | use constant MAX_ERROR_ENVELOPE_BYTES => 16 * 1024; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 10 | field $endpoint :param :reader = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 10 | field $options :param :reader = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 10 | field $api_version :param = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 10 | field $diagnostics_enabled :param = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | field $credential :param = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 10 | field $transport :param = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | field $logger :param = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 10 | field $max_response_bytes :param = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 10 | field $pipeline = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 80 | ▶ | ADJUST { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 80 | ▶ | return if defined $options; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | my %args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | ▶ | $args{api_version} = $api_version if defined $api_version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | ▶ | $args{diagnostics_enabled} = $diagnostics_enabled if defined $diagnostics_enabled; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | ▶ | $args{credential} = $credential if defined $credential; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | ▶ | $args{transport} = $transport if defined $transport; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | ▶ | $args{logger} = $logger if defined $logger; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 3 | ▶ | $args{max_response_bytes} = $max_response_bytes if defined $max_response_bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | $options = Azure::SDK::Core::ClientOptions->new(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | method api_version () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api_version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | return $options->api_version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | ▶ | method diagnostics_enabled () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diagnostics_enabled: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | return $options->diagnostics_enabled; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 109 | ▶ | method pipeline () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pipeline: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 109 | ▶ | $pipeline //= $options->build_pipeline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$pipeline //= $options->build_pipeline
MC/DC0%0/2
$pipeline //= $options->build_pipeline
$pipeline
$options->build_pipeline
Truth table66%2/3
A //= B
A= $pipelineB= $options->build_pipeline
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 109 | return $pipeline; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 110 | ▶ | method send ($request, $context = undef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send: called CC=7 SCAR=20.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 110 | ▶ | croak 'Azure::SDK::Core->send requires an Azure::SDK::Core::Request' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $request and builtin::blessed($request) and $request->isa("Azure::SDK::Core::Request")
defined $request and builtin::blessed($request)
MC/DC33%1/3
defined $request and builtin::blessed($request) and $request->isa("Azure::SDK::Core::Request")
defined $request
builtin::blessed($request)
$request->isa("Azure::SDK::Core::Request")
Truth table50%2/4
A and B and C
A= defined $requestB= builtin::blessed($request)C= $request->isa("Azure::SDK::Core::Request")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | unless defined $request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | && Scalar::Util::blessed($request) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | && $request->isa('Azure::SDK::Core::Request'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 109 | ▶ | $context //= Azure::SDK::Core::Context->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$context //= "Azure::SDK::Core::Context"->new
MC/DC0%0/2
$context //= "Azure::SDK::Core::Context"->new
$context
"Azure::SDK::Core::Context"->new
Truth table33%1/3
A //= B
A= $contextB= "Azure::SDK::Core::Context"->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 109 | my $response = $self->pipeline->send($context, $request); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 109 | ▶ | $self->_raise_error($response) unless $response->is_success; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 75 | return $response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # Parses the response body for an Azure REST error envelope and throws | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # Azure::SDK::Core::Error. Called on any non-2xx pipeline result. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 34 | ▶ | method _raise_error ($response) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_raise_error: called CC=30 SCAR=38.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 34 | my ($code, $message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 34 | my $parsed = eval { $response->decoded_json }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 34 | ▶ | if (ref $parsed eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 5 | ▶ | my $err = $parsed->{error} // $parsed->{'odata.error'} // $parsed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
($parsed->{"error"} // $parsed->{"odata.error"}) // $parsed
$parsed->{"error"} // $parsed->{"odata.error"}
MC/DC0%0/3
($parsed->{"error"} // $parsed->{"odata.error"}) // $parsed
$parsed->{"error"}
$parsed->{"odata.error"}
$parsed
Truth table75%3/4
A // B // C
A= $parsed->{"error"}B= $parsed->{"odata.error"}C= $parsed
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 5 | ▶ | if (ref $err eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | $code = $err->{code} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 5 | ▶ | if defined $err->{code} && !ref $err->{code}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $err->{"code"} and not ref $err->{"code"}
MC/DC50%1/2
defined $err->{"code"} and not ref $err->{"code"}
defined $err->{"code"}
not ref $err->{"code"}
Truth table66%2/3
A and not(B)
A= defined $err->{"code"}B= not ref $err->{"code"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 5 | my $error_message = $err->{message}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | $error_message = $error_message->{value} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 5 | ▶ | if ref $error_message eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 5 | ▶ | $message = $error_message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $error_message and not ref $error_message
MC/DC50%1/2
defined $error_message and not ref $error_message
defined $error_message
not ref $error_message
Truth table66%2/3
A and not(B)
A= defined $error_messageB= not ref $error_message
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | if defined $error_message && !ref $error_message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 5 | ▶ | if (!defined $message) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | my $title = $err->{title}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | ▶ | $title = undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $title and not ref $title and length $title
defined $title and not ref $title
MC/DC0%0/3
defined $title and not ref $title and length $title
defined $title
not ref $title
length $title
Truth table25%1/4
A and not(B) and C
A= defined $titleB= not ref $titleC= length $title
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | unless defined $title && !ref $title && length $title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | my $detail = $err->{detail}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | ▶ | $detail = undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $detail and not ref $detail and length $detail
defined $detail and not ref $detail
MC/DC0%0/3
defined $detail and not ref $detail and length $detail
defined $detail
not ref $detail
length $detail
Truth table25%1/4
A and not(B) and C
A= defined $detailB= not ref $detailC= length $detail
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | unless defined $detail && !ref $detail && length $detail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | $message = defined $title && defined $detail && $title ne $detail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition22%2/9
defined $title and defined $detail and $title ne $detail
defined $title and defined $detail
$detail // $title
MC/DC0%0/3
defined $title and defined $detail and $title ne $detail
defined $title
defined $detail
$title ne $detail
MC/DC0%0/2
$detail // $title
$detail
$title
Truth table25%1/4
A and B and C
A= defined $titleB= defined $detailC= $title ne $detail
Truth table0%0/3
A // B
A= $detailB= $title
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ? "$title: $detail" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | : $detail // $title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | my $problem_type = $err->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 5 | ▶ | $code = $problem_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
not defined $code and defined $problem_type and not ref $problem_type and length $problem_type
not defined $code and defined $problem_type and not ref $problem_type
not defined $code and defined $problem_type
MC/DC50%2/4
not defined $code and defined $problem_type and not ref $problem_type and length $problem_type
not defined $code
defined $problem_type
not ref $problem_type
length $problem_type
Truth table60%3/5
not(A) and B and not(C) and D
A= not defined $codeB= defined $problem_typeC= not ref $problem_typeD= length $problem_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | if !defined $code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | && defined $problem_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | && !ref $problem_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | && length $problem_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 34 | ▶ | if (!defined $code || !defined $message) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $code and defined $message
MC/DC50%1/2
defined $code and defined $message
defined $code
defined $message
Truth table66%2/3
A and B
A= defined $codeB= defined $message
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 30 | my ($xml_code, $xml_message) = _parse_xml_error($response->body); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 30 | ▶ | $code //= $xml_code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$code //= $xml_code
MC/DC50%1/2
$code //= $xml_code
$code
$xml_code
Truth table66%2/3
A //= B
A= $codeB= $xml_code
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 30 | ▶ | $message //= $xml_message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$message //= $xml_message
MC/DC100%2/2
$message //= $xml_message
$message
$xml_message
Truth table100%3/3
A //= B
A= $messageB= $xml_message
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 34 | ▶ | $message //= 'HTTP ' . $response->status . ' error'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$message //= 'HTTP ' . $response->status . ' error'
MC/DC100%1/1
$message //= 'HTTP ' . $response->status . ' error'
$message
Truth table100%2/2
A
A= $message
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 34 | Azure::SDK::Core::Error->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | message => $message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | status => $response->status, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | code => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | body => $response->body, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | )->throw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | ▶ | method as_hashref () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_hashref: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1 | endpoint => $endpoint, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | api_version => $options->api_version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | diagnostics_enabled => $options->diagnostics_enabled, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 30 | ▶ | sub _parse_xml_error ($body) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_xml_error: called CC=8 SCAR=21.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 30 | ▶ | return unless defined $body && $body =~ /<Error[\s>]/s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $body and $body =~ /<Error[\s>]/su
MC/DC100%2/2
defined $body and $body =~ /<Error[\s>]/su
defined $body
$body =~ /<Error[\s>]/su
Truth table100%3/3
A and B
A= defined $bodyB= $body =~ /<Error[\s>]/su
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 25 | ▶ | return if bytes::length($body) > MAX_ERROR_ENVELOPE_BYTES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 25 | my $parser = XML::LibXML->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | no_network => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | load_ext_dtd => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | expand_entities => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | huge => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | recover => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | no_blanks => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | $parser->set_option( ext_ent_handler => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | croak 'Refusing to resolve an external entity in an Azure error response'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 25 | } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 25 | my $document = eval { $parser->load_xml( string => $body ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 25 | ▶ | return unless defined $document; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 25 | ▶ | return if defined $document->internalSubset || defined $document->externalSubset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $document->internalSubset or defined $document->externalSubset
MC/DC50%1/2
defined $document->internalSubset or defined $document->externalSubset
defined $document->internalSubset
defined $document->externalSubset
Truth table66%2/3
A or B
A= defined $document->internalSubsetB= defined $document->externalSubset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 24 | my ($root) = $document->findnodes('/*[local-name()="Error"]'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 24 | ▶ | return unless defined $root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 24 | return _xml_child_text( $root, 'Code' ), _xml_child_text( $root, 'Message' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 48 | ▶ | sub _xml_child_text ( $root, $name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_xml_child_text: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 48 | my ($node) = $root->findnodes( './*[local-name()="' . $name . '"]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 48 | ▶ | return undef unless defined $node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 48 | my $value = $node->textContent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 48 | $value =~ s/\A\s+|\s+\z//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 48 | ▶ | return length $value ? $value : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 10 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||