blib/lib/AWS/Signature/V4/Error.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 29 CC 2 SCAR 11.5
CC
2
Cov
0%
shown
6.0
fail
2.0
BEGIN
2.0
CRAP 3.1
1 package AWS::Signature::V4::Error;
2 use v5.24;
3 use Carp ();
4 use Exporter qw< import >;
5 use Ouch ();
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;