| 1 | package WebService::Shutterstock::Exception; | ||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||
| 3 | 9 | $WebService::Shutterstock::Exception::VERSION = '0.006'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Exception object to allow for easy error handling on HTTP errors | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use overload q("") => \&to_string; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 9 | has request => ( is => 'lazy', required => 0, handles => ['uri', 'method'] ); | |||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub _build_request { | ||||||||||||||||||||||||||
|
Subroutine
_build_request: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 17 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 18 | 0 | ▶ | return $self->response ? $self->response->request : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 9 | has response => ( is => 'ro', required => 0, handles => ['code'] ); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 9 | has error => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 9 | has caller_info => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub BUILDARGS { | ||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 33 | 0 | my $args = $class->SUPER::BUILDARGS(@_); | |||||||||||||||||||||||||||
| 34 | 0 | my $level = 0; | |||||||||||||||||||||||||||
| 35 | 0 | ▶ | while(!$args->{caller_info} || $args->{caller_info}->{package} =~ /^(Sub::Quote|WebService::Shutterstock)/){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $args->{"caller_info"} or $args->{"caller_info"}{"package"} =~ /^(Sub::Quote|WebService::Shutterstock)/
MC/DC0%0/2
not $args->{"caller_info"} or $args->{"caller_info"}{"package"} =~ /^(Sub::Quote|WebService::Shutterstock)/
not $args->{"caller_info"}
$args->{"caller_info"}{"package"} =~ /^(Sub::Quote|WebService::Shutterstock)/
Truth table0%0/3
not(A) or B
A= not $args->{"caller_info"}B= $args->{"caller_info"}{"package"} =~ /^(Sub::Quote|WebService::Shutterstock)/
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my @info = caller($level++) or last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | $args->{caller_info} = { package => $info[0], file => $info[1], line => $info[2] }; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $args->{caller_info} ||= { package => 'N/A', file => 'N/A', line => -1 }; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"caller_info"} ||= {"package", "N/A", "file", "N/A", "line", -1}
MC/DC0%0/1
$args->{"caller_info"} ||= {"package", "N/A", "file", "N/A", "line", -1}
$args->{"caller_info"}
Truth table0%0/2
A
A= $args->{"caller_info"}
| |||||||||||||||||||||||||||||
| 40 | 0 | return $args; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub to_string { | ||||||||||||||||||||||||||
|
Subroutine
to_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 45 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 46 | 0 | return sprintf("%s at %s line %s.\n", $self->error, $self->caller_info->{file}, $self->caller_info->{line}); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 9 | 1; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||||||||||