| 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::Core::Policy; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 5 | class Azure::SDK::Storage::Tables::SharedKey :isa(Azure::SDK::Core::Policy) { | |||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use POSIX qw(strftime); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use URI (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use URI::Escape qw(uri_unescape); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 5 | field $credential :param :reader; | |||||||||||||||||||||||||||
| 14 | 5 | field $api_version :param :reader = '2025-11-05'; | |||||||||||||||||||||||||||
| 15 | 5 | field $clock :param = undef; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 19 | ▶ | ADJUST { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=22.0
| |||||||||||||||||||||||||||||
| 18 | 19 | ▶ | croak 'Azure::SDK::Storage::Tables::SharedKey requires a SharedKey credential' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $credential and $credential->isa("Azure::SDK::Core::Credential::SharedKey")
MC/DC0%0/2
defined $credential and $credential->isa("Azure::SDK::Core::Credential::SharedKey")
defined $credential
$credential->isa("Azure::SDK::Core::Credential::SharedKey")
Truth table33%1/3
A and B
A= defined $credentialB= $credential->isa("Azure::SDK::Core::Credential::SharedKey")
| |||||||||||||||||||||||||||||
| 19 | unless defined $credential | ||||||||||||||||||||||||||||
| 20 | && $credential->isa('Azure::SDK::Core::Credential::SharedKey'); | ||||||||||||||||||||||||||||
| 21 | 19 | ▶ | croak 'Azure::SDK::Storage::Tables::SharedKey api_version is required' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $api_version and length $api_version
MC/DC0%0/2
defined $api_version and length $api_version
defined $api_version
length $api_version
Truth table33%1/3
A and B
A= defined $api_versionB= length $api_version
| |||||||||||||||||||||||||||||
| 22 | unless defined $api_version && length $api_version; | ||||||||||||||||||||||||||||
| 23 | 19 | ▶ | $clock //= sub { time }; | ||||||||||||||||||||||||||
|
Condition66%2/3
$clock //= sub {
time;
}
MC/DC0%0/2
$clock //= sub {
time;
}
$clock
sub {
time;
}
Truth table66%2/3
A //= B
A= $clockB= sub {
time;
}
| |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 21 | ▶ | method send ($context, $request, $next) { | ||||||||||||||||||||||||||
|
Subroutine
send: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 27 | 21 | $request->set_header('x-ms-date', _http_date($clock->())); | |||||||||||||||||||||||||||
| 28 | 21 | $request->set_header('x-ms-version', $api_version); | |||||||||||||||||||||||||||
| 29 | 21 | $request->set_header( | |||||||||||||||||||||||||||
| 30 | 'Authorization', | ||||||||||||||||||||||||||||
| 31 | $credential->authorization_header($self->string_to_sign($request)), | ||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||
| 33 | 21 | return $next->($context, $request); | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 24 | ▶ | method string_to_sign ($request) { | ||||||||||||||||||||||||||
|
Subroutine
string_to_sign: called CC=13 SCAR=27.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | 24 | ▶ | my $date = $request->header('x-ms-date') | ||||||||||||||||||||||||||
|
Condition40%2/5
($request->header("x-ms-date") // $request->header("Date")) // ""
$request->header("x-ms-date") // $request->header("Date")
MC/DC0%0/2
($request->header("x-ms-date") // $request->header("Date")) // ""
$request->header("x-ms-date")
$request->header("Date")
Truth table33%1/3
A // B
A= $request->header("x-ms-date")B= $request->header("Date")
| |||||||||||||||||||||||||||||
| 38 | // $request->header('Date') | ||||||||||||||||||||||||||||
| 39 | // ''; | ||||||||||||||||||||||||||||
| 40 | 24 | my $uri = URI->new($request->url); | |||||||||||||||||||||||||||
| 41 | 24 | ▶ | my $resource = '/' . $credential->account_name . ($uri->path // ''); | ||||||||||||||||||||||||||
|
Condition50%1/2
$uri->path // ""
MC/DC0%0/1
$uri->path // ""
$uri->path
Truth table50%1/2
A
A= $uri->path
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 24 | my @comp; | |||||||||||||||||||||||||||
| 44 | 24 | ▶ | for my $part (split /[&;]/, $uri->query // '') { | ||||||||||||||||||||||||||
|
Condition100%2/2
$uri->query // ""
MC/DC100%1/1
$uri->query // ""
$uri->query
Truth table100%2/2
A
A= $uri->query
| |||||||||||||||||||||||||||||
| 45 | 21 | my ($raw_name, $raw_value) = split /=/, $part, 2; | |||||||||||||||||||||||||||
| 46 | 21 | ▶ | next unless defined $raw_name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 21 | ▶ | push @comp, defined $raw_value ? $raw_value : '' | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 48 | if lc(uri_unescape($raw_name)) eq 'comp'; | ||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 24 | ▶ | croak 'Table request query contains repeated comp parameters' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | if @comp > 1; | ||||||||||||||||||||||||||||
| 52 | 24 | ▶ | $resource .= '?comp=' . $comp[0] if @comp; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 24 | ▶ | return join("\n", | ||||||||||||||||||||||||||
|
Condition75%3/4
$request->header("Content-MD5") // ""
$request->header("Content-Type") // ""
MC/DC0%0/1
$request->header("Content-MD5") // ""
$request->header("Content-MD5")
MC/DC100%1/1
$request->header("Content-Type") // ""
$request->header("Content-Type")
Truth table50%1/2
A
A= $request->header("Content-MD5")
Truth table100%2/2
A
A= $request->header("Content-Type")
| |||||||||||||||||||||||||||||
| 55 | $request->method, | ||||||||||||||||||||||||||||
| 56 | $request->header('Content-MD5') // '', | ||||||||||||||||||||||||||||
| 57 | $request->header('Content-Type') // '', | ||||||||||||||||||||||||||||
| 58 | $date, | ||||||||||||||||||||||||||||
| 59 | $resource, | ||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 21 | ▶ | sub _http_date ($epoch) { | ||||||||||||||||||||||||||
|
Subroutine
_http_date: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 64 | 21 | return strftime('%a, %d %b %Y %H:%M:%S GMT', gmtime($epoch)); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 5 | 1; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | __END__ | ||||||||||||||||||||||||||||