| 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 | class Azure::SDK::Storage::Blobs::BlobItem { | |||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | field $name :param :reader = undef; | |||||||||||||||||||||||||||
| 9 | 3 | field $etag :param :reader = undef; | |||||||||||||||||||||||||||
| 10 | 3 | field $last_modified :param :reader = undef; | |||||||||||||||||||||||||||
| 11 | 3 | field $content_length :param :reader = undef; | |||||||||||||||||||||||||||
| 12 | 3 | field $content_type :param :reader = undef; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 3 | field $etag_is_weak :reader = 0; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 19 | ▶ | ADJUST { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=17.2
| |||||||||||||||||||||||||||||
| 17 | 19 | ▶ | croak 'Azure::SDK::Storage::Blobs::BlobItem requires a name' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $name and length $name
MC/DC0%0/2
defined $name and length $name
defined $name
length $name
Truth table33%1/3
A and B
A= defined $nameB= length $name
| |||||||||||||||||||||||||||||
| 18 | unless defined $name && length $name; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 19 | ( $etag, $etag_is_weak ) = _normalize_etag($etag); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 19 | ▶ | if ( defined $content_length ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 10 | ▶ | croak 'Azure::SDK::Storage::Blobs::BlobItem content_length must be numeric' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | unless $content_length =~ /\A[0-9]+\z/; | ||||||||||||||||||||||||||||
| 25 | 10 | $content_length = 0 + $content_length; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # The service is not self-consistent about quoting: the ETag response header | ||||||||||||||||||||||||||||
| 30 | # is quoted, the <Etag> listing element is not. | ||||||||||||||||||||||||||||
| 31 | 5 | ▶ | sub normalize_etag ( $class, $value ) { | ||||||||||||||||||||||||||
|
Subroutine
normalize_etag: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 5 | my ($normalized) = _normalize_etag($value); | |||||||||||||||||||||||||||
| 33 | 5 | return $normalized; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | # Quoting differences collapse, strength does not: RFC 9110 requires a strong | ||||||||||||||||||||||||||||
| 37 | # comparison for If-Match, so folding W/"tag" into "tag" would let a weak | ||||||||||||||||||||||||||||
| 38 | # validator be used as a strong precondition. | ||||||||||||||||||||||||||||
| 39 | 24 | ▶ | sub _normalize_etag ($value) { | ||||||||||||||||||||||||||
|
Subroutine
_normalize_etag: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 40 | 24 | ▶ | return ( undef, 0 ) unless defined $value && length $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $value and length $value
MC/DC100%2/2
defined $value and length $value
defined $value
length $value
Truth table100%3/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 21 | my $normalized = $value; | |||||||||||||||||||||||||||
| 43 | 21 | $normalized =~ s/\A\s+|\s+\z//g; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 21 | ▶ | my $weak = $normalized =~ s/\AW\/// ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 21 | $normalized =~ s/\A"(.*)"\z/$1/s; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 21 | ▶ | return length $normalized ? ( $normalized, $weak ) : ( undef, 0 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | method as_hashref () { | ||||||||||||||||||||||||||
|
Subroutine
as_hashref: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 53 | return { | ||||||||||||||||||||||||||||
| 54 | 0 | name => $name, | |||||||||||||||||||||||||||
| 55 | etag => $etag, | ||||||||||||||||||||||||||||
| 56 | etag_is_weak => $etag_is_weak, | ||||||||||||||||||||||||||||
| 57 | last_modified => $last_modified, | ||||||||||||||||||||||||||||
| 58 | content_length => $content_length, | ||||||||||||||||||||||||||||
| 59 | content_type => $content_type, | ||||||||||||||||||||||||||||
| 60 | }; | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 3 | 1; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||