Net/Amazon/S3/Error/Handler/Confess.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 34 / 34 CC 4 SCAR 10.0
CC
4
Cov
100%
handle_error
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Net/Amazon/S3.pm ↑ Summary Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm »
1 package Net::Amazon::S3::Error::Handler::Confess;
2 99 $Net::Amazon::S3::Error::Handler::Confess::VERSION = '0.992';
3 # ABSTRACT: An internal class to report errors via Carp::confess
4  
5 99 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 99 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 99 ▶use HTTP::Status;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 99 extends 'Net::Amazon::S3::Error::Handler';
10  
11 99 our @CARP_NOT = (__PACKAGE__);
12  
13 99 my %return_false = (
14 NoSuchKey => {
15 'Net::Amazon::S3::Operation::Object::Head::Response' => 1,
16 },
17 NoSuchBucket => {
18 'Net::Amazon::S3::Operation::Object::Head::Response' => 1,
19 },
20 '404' => {
21 'Net::Amazon::S3::Operation::Object::Head::Response' => 1,
22 },
23 );
24  
25 99 ▶sub handle_error {
Subroutine handle_error: called CC=4 SCAR=13.9
Pod documented
26 99 my ($self, $response) = @_;
27  
28 99 ▶ return 1 unless $response->is_error;
Branch: 1 branch
BranchTrueFalseTotal
unless $response->is_error 42 57 99
29  
30 return 0
31 if exists $return_false{ $response->error_code }
32 57 ▶ && exists $return_false{ $response->error_code }{ ref $response }
Branch: 1 branch
BranchTrueFalseTotal
if exists $return_false{$response->error_code} and exists $return_false{$response->error_code}{ref $response} 2 55 57
Condition100%3/3
exists $return_false{$response->error_code} and exists $return_false{$response->error_code}{ref $response}
!ll&&!rl&&r
37182
MC/DC100%2/2
exists $return_false{$response->error_code} and exists $return_false{$response->error_code}{ref $response}
exists $return_false{$response->error_code} exists $return_false{$response->error_code}{ref $response}
Truth table100%3/3
A and B
A= exists $return_false{$response->error_code}B= exists $return_false{$response->error_code}{ref $response}
ABresult
0X0
100
111
33 ;
34  
35 55 Carp::confess ("${\ $response->error_code }: ${\ $response->error_message }");
36 }
37  
38 99 1;
39  
40 __END__
« Net/Amazon/S3.pm ↑ Summary Net/Amazon/S3/Request/Role/HTTP/Header/Copy_source.pm »