File Coverage

blib/lib/Google/Search/Error.pm
Criterion Covered Total %
statement 9 13 69.2
branch 0 2 0.0
condition n/a
subroutine 3 5 60.0
pod 0 1 0.0
total 12 21 57.1


line stmt bran cond sub pod time code
1             package Google::Search::Error;
2              
3 5     5   28 use Any::Moose;
  5         9  
  5         31  
4 5     5   7342 use Google::Search::Carp;
  5         10  
  5         35  
5              
6             use overload
7 5         58 "" => \&reason,
8             fallback => 1,
9 5     5   5872 ;
  5         10  
10              
11             has code => qw/ is ro isa Int /;
12             has message => qw/ is ro isa Str /, default => '';
13             has http_response => qw/ is ro isa HTTP::Response /;
14             has _reason => qw/ init_arg reason is ro isa Str lazy_build 1 /;
15             sub _build__reason {
16 0     0     my $self = shift;
17 0 0         return $self->message unless defined $self->code;
18 0           return join " ", $self->code, $self->message;
19             }
20              
21             sub reason {
22 0     0 0   return shift->_reason( @_ );
23             }
24              
25             1;