line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Spinn3r::next_request_url; |
2
|
2
|
|
|
2
|
|
19
|
use base WWW::Spinn3r::Common; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
218
|
|
3
|
2
|
|
|
2
|
|
3154
|
use XML::Twig; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use utf8; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my ($class, %args) = @_; |
9
|
|
|
|
|
|
|
my $self = bless { %args }, $class; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $twig = new XML::Twig ( |
12
|
|
|
|
|
|
|
expand_external_ents => 0, |
13
|
|
|
|
|
|
|
twig_roots => { |
14
|
|
|
|
|
|
|
'api:next_request_url' => sub { $self->next_request_url(@_) }, |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
pretty_print => '', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$self->{results}->{'api:next_request_url'} = ''; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $start = $self->start_timer; |
22
|
|
|
|
|
|
|
$self->debug("$class: parsing XML..."); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
eval { |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
if ($args{path}) { |
27
|
|
|
|
|
|
|
$twig->parsefile($args{path}); |
28
|
|
|
|
|
|
|
} elsif ($args{string}) { |
29
|
|
|
|
|
|
|
$twig->parse($args{string}); |
30
|
|
|
|
|
|
|
} elsif ($args{stringref}) { |
31
|
|
|
|
|
|
|
$twig->parse(${$args{stringref}}); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
if ($@) { |
37
|
|
|
|
|
|
|
$self->debug("xml = \"${$args{stringref}}\""); |
38
|
|
|
|
|
|
|
die $@; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $howlong = $self->howlong($start); |
42
|
|
|
|
|
|
|
$self->debug("$class: parse complete in $howlong seconds"); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$twig->purge; # clean up all the memory. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return $self->{results}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub next_request_url { |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my ($self, $twig, $root) = @_; |
52
|
|
|
|
|
|
|
my $url = $root->text; |
53
|
|
|
|
|
|
|
$self->{results}->{'api:next_request_url'} = $url; |
54
|
|
|
|
|
|
|
$twig->finish; # no more parsing! |
55
|
|
|
|
|
|
|
return; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |