blib/lib/Paws/Net/V4Signature.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 66.6% 4 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 80.0% 32 / 40 CC 5 SCAR 12.2
CC
5
Cov
87%
sign
5.3
BEGIN
1.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Paws/MWAA.pm ↑ Summary blib/lib/Paws/CloudWatchEvents.pm »
1 package Paws::Net::V4Signature;
2 21 ▶ use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 21 ▶ use Net::Amazon::Signature::V4;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 #requires 'region';
5 21 requires 'service';
6 21 ▶ use POSIX qw(strftime);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 495 ▶ sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
9 495 my $self = shift;
10  
11 # These calls are here so that when you construct
12 # the object the endpoint information and the _region_for_signature
13 # are calculated during construction. This is to avoid the fact that
14 # these attributes are lazy (because they depend on other attributes)
15 # and they don't get used until the first method is called, so if
16 # they are incorrect, they don't throw until the first method is called.
17 # It's much better to have them throw when $paws->service('...') is called
18 # as this is the point where the user had specified "incorrect" information,
19 # instead of the problem happening in the first method call.
20 495 $self->endpoint;
21 495 $self->_region_for_signature;
22 }
23  
24 158 ▶ sub sign {
Subroutine sign: called CC=5 SCAR=16.7
Pod undocumented
25 158 my ($self, $request) = @_;
26  
27 158 ▶ $request->header( Date => $request->header('X-Amz-Date') // strftime( '%Y%m%dT%H%M%SZ', gmtime ) );
Condition66%2/3
$request->header("X-Amz-Date") // strftime("%Y%m%dT%H%M%SZ", gmtime)
l!l&&r!l&&!r
301280
MC/DC0%0/2
$request->header("X-Amz-Date") // strftime("%Y%m%dT%H%M%SZ", gmtime)
$request->header("X-Amz-Date") strftime("%Y%m%dT%H%M%SZ", gmtime)
Truth table66%2/3
A // B
A= $request->header("X-Amz-Date")B= strftime("%Y%m%dT%H%M%SZ", gmtime)
ABresult
1X1
011
000
28 158 ▶ $request->header(
Branch: 1 branch
BranchTrueFalseTotal
$self->endpoint->default_port == $self->endpoint->port ? : 145 13 158
29 'Host' => $self->endpoint->default_port == $self->endpoint->port
30 ? $self->endpoint->host
31 : $self->endpoint->host_port);
32 158 ▶ if ($self->session_token) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->session_token) 0 158 158
33 0 $request->header( 'X-Amz-Security-Token' => $self->session_token );
34 }
35  
36 158 ▶ my $name = $self->can('signing_name') ? $self->signing_name : $self->service;
Branch: 1 branch
BranchTrueFalseTotal
$self->can('signing_name') ? : 158 0 158
37 158 my $sig = Net::Amazon::Signature::V4->new( $self->access_key, $self->secret_key, $self->_region_for_signature, $name );
38 158 $sig->sign( $request );
39 }
40 21 1;
« blib/lib/Paws/MWAA.pm ↑ Summary blib/lib/Paws/CloudWatchEvents.pm »