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.006'; |
5
|
5
|
|
|
5
|
|
36
|
use Moo; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
30
|
|
6
|
|
|
|
|
|
|
extends 'LWP::UserAgent'; |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
4084
|
use HTTP::Cookies; |
|
5
|
|
|
|
|
60680
|
|
|
5
|
|
|
|
|
213
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with qw( WWW::Chain::UA ); |
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
36
|
use Scalar::Util 'blessed'; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
239
|
|
13
|
5
|
|
|
5
|
|
31
|
use Safe::Isa; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1142
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub request_chain { |
16
|
2
|
|
|
2
|
0
|
4747
|
my ( $self, $chain ) = @_; |
17
|
2
|
50
|
33
|
|
|
59
|
die __PACKAGE__."->request_chain needs a WWW::Chain object as parameter" |
18
|
|
|
|
|
|
|
unless ( blessed($chain) && $chain->$_isa('WWW::Chain') ); |
19
|
2
|
50
|
|
|
|
85
|
$self->cookie_jar({}) unless $self->cookie_jar; |
20
|
2
|
|
|
|
|
552
|
while (!$chain->done) { |
21
|
4
|
|
|
|
|
9
|
my @responses; |
22
|
4
|
|
|
|
|
9
|
for (@{$chain->next_requests}) { |
|
4
|
|
|
|
|
21
|
|
23
|
4
|
|
|
|
|
64
|
my $response = $self->request($_); |
24
|
4
|
|
|
|
|
148874
|
push @responses, $response; |
25
|
|
|
|
|
|
|
} |
26
|
4
|
|
|
|
|
26
|
$chain->next_responses(@responses); |
27
|
|
|
|
|
|
|
} |
28
|
2
|
|
|
|
|
39
|
return $chain; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |