| 1 | 6 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use feature 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | no warnings 'experimental::class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Azure::SDK::Storage::Tables::EntityProperty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | class Azure::SDK::Storage::Tables::Entity { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | field $partition_key :param :reader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | field $row_key :param :reader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | field $timestamp :param :reader = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | field $etag :param :reader = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | field $properties :param :reader = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | field $property_types :param = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 132 | ▶ | ADJUST { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=17 SCAR=29.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 132 | _validate_key('partition_key', $partition_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 132 | _validate_key('row_key', $row_key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 132 | ▶ | croak 'Table entity properties must be a hash reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | unless ref $properties eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 132 | ▶ | croak 'Table entity property_types must be a hash reference' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | unless ref $property_types eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 132 | ▶ | croak 'Table entity exceeds 252 custom properties' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | if scalar(keys $properties->%*) > 252; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 131 | ▶ | croak 'Table entity ETag must not contain control characters' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
defined $etag and ref $etag || !length($etag) || $etag =~ /[\x00-\x1f\x7f]/u
ref $etag or not length $etag or $etag =~ /[\x00-\x1f\x7f]/u
ref $etag or not length $etag
MC/DC0%0/4
defined $etag and ref $etag || !length($etag) || $etag =~ /[\x00-\x1f\x7f]/u
defined $etag
ref $etag
not length $etag
$etag =~ /[\x00-\x1f\x7f]/u
Truth table40%2/5
A and B or not(C) or D
A= defined $etagB= ref $etagC= not length $etagD= $etag =~ /[\x00-\x1f\x7f]/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | if defined $etag && (ref($etag) || !length($etag) || $etag =~ /[\x00-\x1f\x7f]/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 131 | my (%values, %types); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 131 | for my $name (keys $properties->%*) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 219 | _validate_property_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 217 | my $value = $properties->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 217 | ▶ | if (blessed($value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($value) and $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
MC/DC50%1/2
builtin::blessed($value) and $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
builtin::blessed($value)
$value->isa("Azure::SDK::Storage::Tables::EntityProperty")
Truth table66%2/3
A and B
A= builtin::blessed($value)B= $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | && $value->isa('Azure::SDK::Storage::Tables::EntityProperty')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | croak "Table entity property '$name' specifies its type twice" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 11 | ▶ | if exists $property_types->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 11 | $values{$name} = $value->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 11 | $types{$name} = $value->type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 206 | $values{$name} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 206 | ▶ | $types{$name} = $property_types->{$name} // 'Edm.String' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$property_types->{$name} // "Edm.String"
MC/DC100%1/1
$property_types->{$name} // "Edm.String"
$property_types->{$name}
Truth table100%2/2
A
A= $property_types->{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | if defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 129 | for my $name (keys $property_types->%*) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | croak "Table entity property type '$name' has no property value" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 13 | ▶ | unless exists $properties->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 129 | for my $name (keys %types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my $validated = Azure::SDK::Storage::Tables::EntityProperty->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | type => $types{$name}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 216 | value => $values{$name}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 216 | $values{$name} = $validated->value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 216 | $types{$name} = $validated->type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 129 | $properties = \%values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 129 | $property_types = \%types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 94 | ▶ | method property_type ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
property_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 94 | return $property_types->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | method property_types () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
property_types: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return { $property_types->%* }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | ▶ | method with_etag ($new_etag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
with_etag: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | return __CLASS__->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | partition_key => $partition_key, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | row_key => $row_key, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | timestamp => $timestamp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | etag => $new_etag, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | properties => { $properties->%* }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | property_types => { $property_types->%* }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 11 | ▶ | sub validate_property_name ( $class, $name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_property_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 11 | return _validate_property_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 264 | ▶ | sub _validate_key ( $label, $value ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_key: called CC=5 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 264 | ▶ | croak "Table entity $label is required" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and not ref $value
MC/DC0%0/2
defined $value and not ref $value
defined $value
not ref $value
Truth table33%1/3
A and not(B)
A= defined $valueB= not ref $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | unless defined $value && !ref $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 264 | ▶ | croak "Table entity $label must not exceed 1024 characters" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | if length($value) > 1024; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 264 | ▶ | croak "Table entity $label contains a character not permitted by Table Storage" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | if $value =~ m{[/\\#?\x00-\x1f\x7f-\x9f]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 230 | ▶ | sub _validate_property_name ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_property_name: called CC=8 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 230 | ▶ | croak 'Table entity property name must be an identifier of at most 255 characters' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
defined $name and not ref $name and length $name <= 255 and $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/u
defined $name and not ref $name and length $name <= 255
defined $name and not ref $name
MC/DC25%1/4
defined $name and not ref $name and length $name <= 255 and $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/u
defined $name
not ref $name
length $name <= 255
$name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/u
Truth table40%2/5
A and not(B) and C and D
A= defined $nameB= not ref $nameC= length $name <= 255D= $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | unless defined $name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | && !ref $name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | && length($name) <= 255 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | && $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 228 | ▶ | croak "Table entity property name '$name' is reserved" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$name eq "PartitionKey" or $name eq "RowKey" or $name eq "Timestamp"
$name eq "PartitionKey" or $name eq "RowKey"
MC/DC33%1/3
$name eq "PartitionKey" or $name eq "RowKey" or $name eq "Timestamp"
$name eq "PartitionKey"
$name eq "RowKey"
$name eq "Timestamp"
Truth table50%2/4
A or B or C
A= $name eq "PartitionKey"B= $name eq "RowKey"C= $name eq "Timestamp"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | if $name eq 'PartitionKey' || $name eq 'RowKey' || $name eq 'Timestamp'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 227 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||