| 1 | 2 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use feature 'class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | no warnings 'experimental::class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Azure::SDK::AppConfiguration::ConfigurationSetting; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | class Azure::SDK::AppConfiguration::Uri { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use URI (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use constant API_VERSION => '1.0'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use constant SNAPSHOT_API_VERSION => '2023-10-01'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | field $endpoint :param :reader = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 12 | ▶ | ADJUST { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=31.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | croak 'Azure::SDK::AppConfiguration::Uri requires an endpoint' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $endpoint and not ref $endpoint and length $endpoint
defined $endpoint and not ref $endpoint
MC/DC0%0/3
defined $endpoint and not ref $endpoint and length $endpoint
defined $endpoint
not ref $endpoint
length $endpoint
Truth table25%1/4
A and not(B) and C
A= defined $endpointB= not ref $endpointC= length $endpoint
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | unless defined $endpoint && !ref $endpoint && length $endpoint; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 12 | my $uri = URI->new($endpoint); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 12 | ▶ | croak 'App Configuration URI endpoint must be absolute' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $uri->scheme and defined $uri->authority
MC/DC0%0/2
defined $uri->scheme and defined $uri->authority
defined $uri->scheme
defined $uri->authority
Truth table33%1/3
A and B
A= defined $uri->schemeB= defined $uri->authority
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | unless defined $uri->scheme && defined $uri->authority; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 12 | ▶ | croak 'App Configuration URI endpoint must not include a path, query, or fragment' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
($uri->path // "") =~ m[\A/?\z]u and not defined $uri->query and not defined $uri->fragment
($uri->path // "") =~ m[\A/?\z]u and not defined $uri->query
$uri->path // ""
MC/DC0%0/3
($uri->path // "") =~ m[\A/?\z]u and not defined $uri->query and not defined $uri->fragment
$uri->path
not defined $uri->query
not defined $uri->fragment
Truth table25%1/4
A and not(B) and not(C)
A= $uri->pathB= not defined $uri->queryC= not defined $uri->fragment
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | unless ($uri->path // '') =~ m{\A/?\z} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | && !defined $uri->query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | && !defined $uri->fragment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 12 | $endpoint = $uri->scheme . '://' . $uri->authority; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 8 | ▶ | method for_setting ($key, $label = undef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_setting: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 8 | Azure::SDK::AppConfiguration::ConfigurationSetting->validate_key($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 8 | ▶ | Azure::SDK::AppConfiguration::ConfigurationSetting->validate_label($label) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | if defined $label; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 8 | my @query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 8 | ▶ | push @query, 'label=' . _encode_component($label) if defined $label; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 8 | push @query, 'api-version=' . API_VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 8 | return $endpoint . '/kv/' . _encode_component($key) . '?' . join('&', @query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | ▶ | method for_settings ($key_filter = undef, $label_filter = undef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_settings: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | my @query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | push @query, 'key=' . _encode_filter('key_filter', $key_filter) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | if defined $key_filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | ▶ | push @query, 'label=' . _encode_label_filter($label_filter) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | if defined $label_filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 3 | push @query, 'api-version=' . API_VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 3 | return $endpoint . '/kv?' . join('&', @query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | method for_labels ($name_filter = undef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_labels: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | my @query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | push @query, 'name=' . _encode_filter('name_filter', $name_filter) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | if defined $name_filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | push @query, 'api-version=' . API_VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | return $endpoint . '/labels?' . join('&', @query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 7 | ▶ | method for_snapshot ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_snapshot: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 7 | _validate_snapshot_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 6 | return $endpoint . '/snapshots/' . _encode_component($name) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | . '?api-version=' . SNAPSHOT_API_VERSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | ▶ | method for_snapshots ($name_filter = undef, $status_filter = undef) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_snapshots: called CC=12 SCAR=26.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | my @query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | ▶ | push @query, 'name=' . _encode_filter('name_filter', $name_filter) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | if defined $name_filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | ▶ | if (defined $status_filter) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | my @statuses = ref $status_filter eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | ? @{$status_filter} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | : ($status_filter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | croak 'App Configuration snapshot status filter must contain one to five values' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@statuses >= 1 and @statuses <= 5
MC/DC0%0/2
@statuses >= 1 and @statuses <= 5
@statuses >= 1
@statuses <= 5
Truth table33%1/3
A and B
A= @statuses >= 1B= @statuses <= 5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | unless @statuses >= 1 && @statuses <= 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | for my $status (@statuses) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | ▶ | croak 'App Configuration snapshot status filter is invalid' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $status and not ref $status and $status =~ /\A(?:provisioning|ready|archived|failed)\z/u
defined $status and not ref $status
MC/DC33%1/3
defined $status and not ref $status and $status =~ /\A(?:provisioning|ready|archived|failed)\z/u
defined $status
not ref $status
$status =~ /\A(?:provisioning|ready|archived|failed)\z/u
Truth table50%2/4
A and not(B) and C
A= defined $statusB= not ref $statusC= $status =~ /\A(?:provisioning|ready|archived|failed)\z/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | unless defined $status && !ref $status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | && $status =~ /\A(?:provisioning|ready|archived|failed)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | push @query, 'status=' . join(',', @statuses); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | push @query, 'api-version=' . SNAPSHOT_API_VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | return $endpoint . '/snapshots?' . join('&', @query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | method for_snapshot_settings ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_snapshot_settings: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | _validate_snapshot_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | return $endpoint . '/kv?snapshot=' . _encode_component($name) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | . '&api-version=' . SNAPSHOT_API_VERSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | method for_snapshot_operation ($location, $name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_snapshot_operation: called CC=21 SCAR=36.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | _validate_snapshot_name($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | ▶ | croak 'App Configuration snapshot operation location is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $location and not ref $location and length $location
defined $location and not ref $location
MC/DC0%0/3
defined $location and not ref $location and length $location
defined $location
not ref $location
length $location
Truth table25%1/4
A and not(B) and C
A= defined $locationB= not ref $locationC= length $location
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | unless defined $location && !ref $location && length $location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | ▶ | croak 'App Configuration snapshot operation location contains unsafe characters' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | if $location =~ /[\x00-\x20\x7f]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | my $candidate = URI->new_abs($location, $endpoint . '/'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | my $base = URI->new($endpoint); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | ▶ | croak 'App Configuration snapshot operation location changed origin' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition54%6/11
lc($candidate->scheme // "") eq lc($base->scheme // "") and lc($candidate->authority // "") eq lc($base->authority // "")
$candidate->scheme // ""
$base->scheme // ""
$candidate->authority // ""
$base->authority // ""
MC/DC0%0/2
lc($candidate->scheme // "") eq lc($base->scheme // "") and lc($candidate->authority // "") eq lc($base->authority // "")
$candidate->scheme
$candidate->authority
MC/DC0%0/1
$base->scheme // ""
$base->scheme
MC/DC0%0/1
$base->authority // ""
$base->authority
Truth table33%1/3
A and B
A= $candidate->schemeB= $candidate->authority
Truth table50%1/2
A
A= $base->scheme
Truth table50%1/2
A
A= $base->authority
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | unless lc($candidate->scheme // '') eq lc($base->scheme // '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | && lc($candidate->authority // '') eq lc($base->authority // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 2 | ▶ | croak 'App Configuration snapshot operation location must target /operations' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$candidate->path // ""
MC/DC0%0/1
$candidate->path // ""
$candidate->path
Truth table50%1/2
A
A= $candidate->path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | unless ($candidate->path // '') eq '/operations'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | croak 'App Configuration snapshot operation location must not include a fragment' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | if defined $candidate->fragment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | my @query = $candidate->query_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | my %values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2 | ▶ | while (@query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 4 | my ($key, $value) = splice @query, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 4 | push @{$values{$key}}, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | croak 'App Configuration snapshot operation location has an invalid snapshot name' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | ▶ | unless @{$values{snapshot} // []} == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$values{"snapshot"} // []
MC/DC0%0/1
$values{"snapshot"} // []
$values{"snapshot"}
Truth table50%1/2
A
A= $values{"snapshot"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | ▶ | && $values{snapshot}[0] eq $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@{$values{"snapshot"} // [];} == 1 and $values{"snapshot"}[0] eq $name
MC/DC0%0/2
@{$values{"snapshot"} // [];} == 1 and $values{"snapshot"}[0] eq $name
@{$values{"snapshot"} // [];} == 1
$values{"snapshot"}[0] eq $name
Truth table33%1/3
A and B
A= @{$values{"snapshot"} // [];} == 1B= $values{"snapshot"}[0] eq $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | croak 'App Configuration snapshot operation location has an invalid api-version' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | ▶ | unless @{$values{'api-version'} // []} == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$values{"api-version"} // []
MC/DC0%0/1
$values{"api-version"} // []
$values{"api-version"}
Truth table50%1/2
A
A= $values{"api-version"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | ▶ | && $values{'api-version'}[0] eq SNAPSHOT_API_VERSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@{$values{"api-version"} // [];} == 1 and $values{"api-version"}[0] eq "2023-10-01"
MC/DC0%0/2
@{$values{"api-version"} // [];} == 1 and $values{"api-version"}[0] eq "2023-10-01"
@{$values{"api-version"} // [];} == 1
$values{"api-version"}[0] eq "2023-10-01"
Truth table33%1/3
A and B
A= @{$values{"api-version"} // [];} == 1B= $values{"api-version"}[0] eq "2023-10-01"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 2 | return $candidate->as_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 6 | ▶ | method for_next_link ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_next_link: called CC=24 SCAR=36.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $next_link, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 6 | $expected_path = '/kv', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 6 | $api_version = API_VERSION, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 6 | ▶ | croak 'App Configuration continuation link is required' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $next_link and not ref $next_link and length $next_link
defined $next_link and not ref $next_link
MC/DC0%0/3
defined $next_link and not ref $next_link and length $next_link
defined $next_link
not ref $next_link
length $next_link
Truth table25%1/4
A and not(B) and C
A= defined $next_linkB= not ref $next_linkC= length $next_link
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | unless defined $next_link && !ref $next_link && length $next_link; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 6 | ▶ | croak 'App Configuration continuation expected path is invalid' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$expected_path eq "/kv" or $expected_path eq "/labels" or $expected_path eq "/snapshots"
$expected_path eq "/kv" or $expected_path eq "/labels"
MC/DC0%0/3
$expected_path eq "/kv" or $expected_path eq "/labels" or $expected_path eq "/snapshots"
$expected_path eq "/kv"
$expected_path eq "/labels"
$expected_path eq "/snapshots"
Truth table75%3/4
A or B or C
A= $expected_path eq "/kv"B= $expected_path eq "/labels"C= $expected_path eq "/snapshots"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | unless $expected_path eq '/kv' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | || $expected_path eq '/labels' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | || $expected_path eq '/snapshots'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | ▶ | croak 'App Configuration continuation link exceeds 8192 bytes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | if length($next_link) > 8192; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 6 | ▶ | croak 'App Configuration continuation link contains unsafe characters' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | if $next_link =~ /[\x00-\x20\x7f]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 6 | my $uri = URI->new($next_link); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 6 | ▶ | croak 'App Configuration continuation link must be relative' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $uri->scheme or defined $uri->authority
MC/DC50%1/2
defined $uri->scheme or defined $uri->authority
defined $uri->scheme
defined $uri->authority
Truth table66%2/3
A or B
A= defined $uri->schemeB= defined $uri->authority
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | if defined $uri->scheme || defined $uri->authority; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 5 | ▶ | croak "App Configuration continuation link must target $expected_path" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$uri->path // ""
MC/DC0%0/1
$uri->path // ""
$uri->path
Truth table50%1/2
A
A= $uri->path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | unless ($uri->path // '') eq $expected_path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 4 | ▶ | croak 'App Configuration continuation link must not include a fragment' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | if defined $uri->fragment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 4 | my @query = $uri->query_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | my @versions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | my @continuations; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 4 | ▶ | while (@query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 14 | my ($name, $value) = splice @query, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 14 | ▶ | push @versions, $value if $name eq 'api-version'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 14 | ▶ | push @continuations, $value if $name eq 'after'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | ▶ | croak 'App Configuration continuation link has an invalid api-version' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@versions == 1 and $versions[0] eq $api_version
MC/DC0%0/2
@versions == 1 and $versions[0] eq $api_version
@versions == 1
$versions[0] eq $api_version
Truth table33%1/3
A and B
A= @versions == 1B= $versions[0] eq $api_version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | unless @versions == 1 && $versions[0] eq $api_version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 4 | ▶ | croak 'App Configuration continuation link has an invalid after token' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@continuations == 1 and defined $continuations[0] and length $continuations[0]
@continuations == 1 and defined $continuations[0]
MC/DC0%0/3
@continuations == 1 and defined $continuations[0] and length $continuations[0]
@continuations == 1
defined $continuations[0]
length $continuations[0]
Truth table25%1/4
A and B and C
A= @continuations == 1B= defined $continuations[0]C= length $continuations[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | unless @continuations == 1 && defined $continuations[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | && length $continuations[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | return $endpoint . $uri->path_query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 6 | ▶ | sub _encode_filter ($name, $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_encode_filter: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 6 | ▶ | croak "App Configuration $name must be a scalar" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | if ref $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 6 | ▶ | croak "App Configuration $name must not be empty" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | unless length $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 6 | ▶ | croak "App Configuration $name contains control characters" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | if $value =~ /[\x00-\x1f\x7f]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 5 | my $bytes = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 5 | utf8::encode($bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 5 | $bytes =~ s/([^A-Za-z0-9\-._~*,])/sprintf('%%%02X', ord $1)/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 5 | return $bytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 4 | ▶ | sub _encode_label_filter ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_encode_label_filter: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 4 | ▶ | return '%00' if !ref $value && $value eq "\0"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $value and $value eq "\0"
MC/DC50%1/2
not ref $value and $value eq "\0"
not ref $value
$value eq "\0"
Truth table66%2/3
not(A) and B
A= not ref $valueB= $value eq "\0"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 3 | return _encode_filter('label_filter', $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 15 | ▶ | sub _encode_component ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_encode_component: called CC=1 SCAR=0.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 15 | my $bytes = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 15 | utf8::encode($bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $bytes =~ s/([^A-Za-z0-9\-._~])/sprintf('%%%02X', ord $1)/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 15 | return $bytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 11 | ▶ | sub _validate_snapshot_name ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_snapshot_name: called CC=8 SCAR=25.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 11 | ▶ | croak 'App Configuration snapshot name must be a non-empty scalar' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $name and not ref $name and length $name
defined $name and not ref $name
MC/DC0%0/3
defined $name and not ref $name and length $name
defined $name
not ref $name
length $name
Truth table25%1/4
A and not(B) and C
A= defined $nameB= not ref $nameC= length $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | unless defined $name && !ref $name && length $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 11 | ▶ | croak "App Configuration snapshot name must not be '.' or '..'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$name eq "." or $name eq ".."
MC/DC0%0/2
$name eq "." or $name eq ".."
$name eq "."
$name eq ".."
Truth table33%1/3
A or B
A= $name eq "."B= $name eq ".."
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | if $name eq '.' || $name eq '..'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 11 | ▶ | croak 'App Configuration snapshot name contains control characters' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | if $name =~ /[\x00-\x1f\x7f]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 11 | ▶ | croak 'App Configuration snapshot name exceeds 256 characters' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | if length $name > 256; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 10 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||