File Coverage

blib/lib/WWW/Chain/UA/LWP.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 4 50.0
condition 1 3 33.3
subroutine 5 5 100.0
pod 0 1 0.0
total 31 36 86.1


line stmt bran cond sub pod time code
1             package WWW::Chain::UA::LWP;
2             our $VERSION = '0.101';
3             our $AUTHORITY = 'cpan:GETTY';
4             # ABSTRACT: Using LWP::UserAgent to execute WWW::Chain chains
5              
6 5     5   42 use Moo;
  5         24  
  5         38  
7             extends 'LWP::UserAgent';
8              
9             with qw( WWW::Chain::UA );
10              
11 5     5   6068 use HTTP::Cookies;
  5         119128  
  5         211  
12 5     5   45 use Scalar::Util 'blessed';
  5         8  
  5         328  
13 5     5   29 use Safe::Isa;
  5         20  
  5         1494  
14              
15             sub request_chain {
16 2     2 0 6694 my ( $self, $chain ) = @_;
17 2 50 33     34 die __PACKAGE__."->request_chain needs a WWW::Chain object as parameter"
18             unless ( blessed($chain) && $chain->$_isa('WWW::Chain') );
19 2 50       129 $self->cookie_jar({}) unless $self->cookie_jar;
20 2         2044 while (!$chain->done) {
21 4         285 my @responses;
22 4         10 for (@{$chain->next_requests}) {
  4         26  
23 4         175 my $response = $self->request($_);
24 4         252408 push @responses, $response;
25             }
26 4         36 $chain->next_responses(@responses);
27             }
28 2         168 return $chain;
29             }
30              
31             1;
32              
33             __END__