lib/AWS/Signature/V4/Error.pm

filter: Statementstmt 81.8% 9 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 86.6% 13 / 15 CC 1 SCAR 0.7
CC
1
Cov
82%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/AWS/Signature/V4/Credentials.pm ↑ Summary lib/AWS/Signature/V4.pm »
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 0 ▶use Ouch ();
Subroutine BEGIN: called CC=1 SCAR=2.6
6  
7 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 $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 sub fail {
21 local $Carp::MaxArgNums = -1; # the trace must not hold secrets
22 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 sub shown {
28 my ($value) = @_;
29 return 'undef' unless defined $value;
30 return $value =~ s{([^\x20-\x7E])}{sprintf '\\x{%X}', ord $1}ger;
31 }
32  
33 1;
« blib/lib/AWS/Signature/V4/Credentials.pm ↑ Summary lib/AWS/Signature/V4.pm »