File Coverage

blib/lib/WWW/Chain/UA/LWP.pm
Criterion Covered Total %
statement 19 19 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 4 4 100.0
pod 0 1 0.0
total 25 29 86.2


line stmt bran cond sub pod time code
1             package WWW::Chain::UA::LWP;
2             our $AUTHORITY = 'cpan:GETTY';
3             # ABSTRACT: Using LWP::UserAgent to execute WWW::Chain chains
4             $WWW::Chain::UA::LWP::VERSION = '0.004';
5 2     2   1329 use Moo;
  2         3  
  2         15  
6             extends 'LWP::UserAgent';
7              
8             with qw( WWW::Chain::UA );
9              
10 2     2   589 use Scalar::Util 'blessed';
  2         8  
  2         119  
11 2     2   14 use Safe::Isa;
  2         2  
  2         474  
12              
13             sub request_chain {
14 1     1 0 42 my ( $self, $chain ) = @_;
15 1 50 33     16 die __PACKAGE__."->request_chain needs a WWW::Chain object as parameter"
16             unless ( blessed($chain) && $chain->$_isa('WWW::Chain') );
17 1         30 while (!$chain->done) {
18 2         4 my @responses;
19 2         2 for (@{$chain->next_requests}) {
  2         9  
20 2         20 my $response = $self->request($_);
21 2         65512 push @responses, $response;
22             }
23 2         10 $chain->next_responses(@responses);
24             }
25 1         16 return $chain;
26             }
27              
28             1;
29              
30             __END__