File Coverage

blib/lib/Google/Search/Page.pm
Criterion Covered Total %
statement 6 15 40.0
branch 0 4 0.0
condition n/a
subroutine 2 5 40.0
pod 0 1 0.0
total 8 25 32.0


line stmt bran cond sub pod time code
1             package Google::Search::Page;
2              
3 5     5   27 use Any::Moose;
  5         9  
  5         43  
4 5     5   3177 use Google::Search::Carp;
  5         12  
  5         42  
5              
6             has search => qw/ is ro required 1 isa Google::Search /;
7             has number => qw/ is ro required 1 isa Int /;
8              
9             has response => qw/ is ro lazy_build 1 /, handles => [qw/ http_response results error /];
10             sub _build_response {
11 0     0     my $self = shift;
12 0           return $self->search->request( start => $self->start );
13             }
14              
15             has start => qw/ is ro lazy_build 1 isa Int /;
16             sub _build_start {
17 0     0     my $self = shift;
18 0           return $self->number * $self->search->rsz2number;
19             }
20              
21             sub result {
22 0     0 0   my $self = shift;
23 0           my $number = shift;
24              
25 0 0         return if $self->error;
26              
27 0 0         return unless $self->results;
28              
29 0           return $self->results->[$number];
30             }
31              
32             1;