| 1 | 5 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use feature 'class'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | no warnings 'experimental::class'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use Azure::SDK::Storage::Tables::EntityProperty; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | class Azure::SDK::Storage::Tables::Filter { | |||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | field $expression :param :reader; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | field $parameters :param = {}; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | field $rendered = undef; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | ADJUST { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=27.4
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | croak 'Table filter expression is required' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $expression and not ref $expression and length $expression
defined $expression and not ref $expression
MC/DC0%0/3
defined $expression and not ref $expression and length $expression
defined $expression
not ref $expression
length $expression
Truth table25%1/4
A and not(B) and C
A= defined $expressionB= not ref $expressionC= length $expression
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | unless defined $expression && !ref $expression && length $expression; | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | croak 'Table filter expression must not contain control characters' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | if $expression =~ /[\x00-\x1f\x7f]/; | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | croak 'Table filter parameters must be a hash reference' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | unless ref $parameters eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 5 | my %used; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | while ($expression =~ /\@([A-Za-z_][A-Za-z0-9_]*)/g) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | $used{$1} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | for my $name (sort keys %used) { | |||||||||||||||||||||||||||||||||||||||||
| 28 | croak "Table filter parameter '$name' has no bound value" | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | ▶ | unless exists $parameters->{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | for my $name (keys $parameters->%*) { | |||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | croak "Invalid Table filter parameter name '$name'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | unless $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | croak "Table filter parameter '$name' is not used" | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | unless $used{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | $rendered = $expression; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | $rendered =~ s/\@([A-Za-z_][A-Za-z0-9_]*)/_literal($1, $parameters->{$1})/ge; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | ▶ | croak 'Table filter contains an unrecognized parameter placeholder' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | if $rendered =~ /\@/; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | ▶ | method to_string () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | return $rendered; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | ▶ | sub _literal ( $name, $value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_literal: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 4 | ▶ | croak "Table filter parameter '$name' has no bound value" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 4 | ▶ | my $property = 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")
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | && $value->isa('Azure::SDK::Storage::Tables::EntityProperty') | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ? $value | ||||||||||||||||||||||||||||||||||||||||||
| 55 | : Azure::SDK::Storage::Tables::EntityProperty->string($value); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | return $property->odata_literal; | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||||||||||||||||