| 1 | 20 | ▶ | use v5.36; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 20 | ▶ | use feature 'class'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 20 | ▶ | no warnings 'experimental::class'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use Azure::SDK::Core::Headers; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 20 | class Azure::SDK::Core::Request { | |||||||||||||||||||||||||||
| 8 | 20 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # The :reader on $method generates an accessor literally named "method", | ||||||||||||||||||||||||||||
| 11 | # which the parser flags as ambiguous with the class-feature "method" keyword | ||||||||||||||||||||||||||||
| 12 | # used to declare the methods below. The keyword always wins (the accessor is | ||||||||||||||||||||||||||||
| 13 | # only reachable as $request->method), so silence the advisory noise locally. | ||||||||||||||||||||||||||||
| 14 | 20 | ▶ | no warnings 'ambiguous'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 20 | field $method :param :reader = undef; | |||||||||||||||||||||||||||
| 17 | 20 | field $url :param :reader = undef; | |||||||||||||||||||||||||||
| 18 | 20 | field $headers :param = {}; | |||||||||||||||||||||||||||
| 19 | 20 | field $body :param :reader = undef; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 198 | ▶ | ADJUST { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 22 | 198 | ▶ | croak 'Azure::SDK::Core::Request requires a method' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $method and length $method
MC/DC50%1/2
defined $method and length $method
defined $method
length $method
Truth table66%2/3
A and B
A= defined $methodB= length $method
| |||||||||||||||||||||||||||||
| 23 | unless defined $method && length $method; | ||||||||||||||||||||||||||||
| 24 | 197 | ▶ | croak 'Azure::SDK::Core::Request requires a url' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $url and length $url
MC/DC50%1/2
defined $url and length $url
defined $url
length $url
Truth table66%2/3
A and B
A= defined $urlB= length $url
| |||||||||||||||||||||||||||||
| 25 | unless defined $url && length $url; | ||||||||||||||||||||||||||||
| 26 | 196 | $method = uc $method; | |||||||||||||||||||||||||||
| 27 | 196 | ▶ | croak 'invalid HTTP method' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | if $method =~ /[^A-Z]/; | ||||||||||||||||||||||||||||
| 29 | 194 | ▶ | croak 'invalid characters in url' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | if $url =~ /[\x00-\x20\x7f]/; | ||||||||||||||||||||||||||||
| 31 | 193 | $headers = Azure::SDK::Core::Headers->new(headers => $headers); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 69 | ▶ | method headers () { | ||||||||||||||||||||||||||
|
Subroutine
headers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 69 | return $headers->as_hashref; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 1190 | ▶ | method header ($name) { | ||||||||||||||||||||||||||
|
Subroutine
header: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 1190 | return $headers->get($name); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 628 | ▶ | method set_header ($name, $value) { | ||||||||||||||||||||||||||
|
Subroutine
set_header: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 628 | $headers->set($name, $value); | |||||||||||||||||||||||||||
| 44 | 621 | return $self; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 38 | ▶ | method set_url ($new_url) { | ||||||||||||||||||||||||||
|
Subroutine
set_url: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 38 | ▶ | croak 'invalid characters in url' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $new_url and $new_url =~ /[\x00-\x20\x7f]/u
MC/DC50%1/2
defined $new_url and $new_url =~ /[\x00-\x20\x7f]/u
defined $new_url
$new_url =~ /[\x00-\x20\x7f]/u
Truth table66%2/3
A and B
A= defined $new_urlB= $new_url =~ /[\x00-\x20\x7f]/u
| |||||||||||||||||||||||||||||
| 49 | if defined $new_url && $new_url =~ /[\x00-\x20\x7f]/; | ||||||||||||||||||||||||||||
| 50 | 37 | $url = $new_url; | |||||||||||||||||||||||||||
| 51 | 37 | return $self; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 1 | ▶ | method with_body ($new_body) { | ||||||||||||||||||||||||||
|
Subroutine
with_body: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 1 | $body = $new_body; | |||||||||||||||||||||||||||
| 56 | 1 | return $self; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 20 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||