line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FirstGoodURL; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '1.11'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1561
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
66196
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
12
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
465
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $status = { 200 => 1 }; |
10
|
|
|
|
|
|
|
my $ctype = {}; |
11
|
|
|
|
|
|
|
my $ua; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
33
|
1
|
|
17
|
sub import { $ua ||= LWP::UserAgent->new } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub with { |
18
|
3
|
|
|
3
|
1
|
214
|
my $class = shift; |
19
|
3
|
50
|
|
|
|
12
|
carp "no content-type or status given" if not @_; |
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
|
|
12
|
$status = { 200 => 1 }; |
22
|
3
|
|
|
|
|
9
|
$ctype = {}; |
23
|
3
|
100
|
|
|
|
28
|
(/\D/ ? $ctype->{$_} : $status->{$_}) = $_ for @_; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
17
|
return $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub in { |
30
|
4
|
|
|
4
|
1
|
54
|
shift; |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
8
|
my $match; |
33
|
|
|
|
|
|
|
|
34
|
4
|
|
|
|
|
10
|
for (@_) { |
35
|
12
|
|
|
|
|
117
|
my $req = $ua->request(HTTP::Request->new(HEAD => $_)); |
36
|
12
|
|
|
|
|
3280337
|
my ($rc,$rt) = ($req->code, $req->content_type); |
37
|
|
|
|
|
|
|
|
38
|
12
|
100
|
50
|
|
|
455
|
if (not keys %$ctype) { $match = $_ and last if $status->{$rc} } |
|
6
|
100
|
|
|
|
50
|
|
39
|
6
|
50
|
|
|
|
131
|
else { next if not $status->{$rc} } |
40
|
|
|
|
|
|
|
|
41
|
5
|
50
|
33
|
|
|
27
|
if (keys %$ctype == 1 and my($regex) = (each %$ctype)[1]) { |
42
|
0
|
0
|
0
|
|
|
0
|
$match = $_ and last if $rt =~ $regex; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
5
|
0
|
0
|
|
|
101
|
else { for (keys %$ctype) { $match = $_ and last if $ctype->{$rt} } } |
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
17
|
$status = { 200 => 1 }; |
49
|
4
|
|
|
|
|
15
|
$ctype = {}; |
50
|
4
|
|
|
|
|
20
|
return $match; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |