lib/AWS/Signature/V4/Error.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 96.6% 29 / 30 CC 2 SCAR 2.6
CC
2
Cov
95%
shown
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/AWS/Signature/V4/Credentials.pm ↑ Summary
1 package AWS::Signature::V4::Error;
2 10 ▶use v5.24;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use Exporter qw< import >;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use Ouch ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 our @EXPORT_OK = qw< fail shown >;
8  
9 # Errors are reported at the caller's line, as croak would do: the frames of
10 # this distribution are skipped when Ouch looks for the culprit.
11 10 $Carp::Internal{$_}++ for qw<
12 AWS::Signature::V4 AWS::Signature::V4::Checksum
13 AWS::Signature::V4::Chunker AWS::Signature::V4::Credentials
14 AWS::Signature::V4::Error AWS::Signature::V4::X509
15 >;
16  
17 # 400 for what the caller provided, 500 for problems inside the module;
18 # everything is passed down to ouch(), the optional third argument included.
19 # No "goto": it would drop the "local" before ouch() gets to build the trace.
20 241 ▶sub fail {
Subroutine fail: called CC=1 SCAR=0.0
Pod documented
21 241 local $Carp::MaxArgNums = -1; # the trace must not hold secrets
22 241 Ouch::ouch(@_);
23 }
24  
25 # caller input, made safe to put in a message: anything that is not printable
26 # ASCII is escaped, so that it cannot forge lines in a log
27 70 ▶sub shown {
Subroutine shown: called CC=2 SCAR=7.0
Pod documented
28 70 my ($value) = @_;
29 70 ▶ return 'undef' unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 70 70
30 70 return $value =~ s{([^\x20-\x7E])}{sprintf '\\x{%X}', ord $1}ger;
31 }
32  
33 10 1;
« lib/AWS/Signature/V4/Credentials.pm ↑ Summary