line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::uri_status_code; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
82996
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
154396
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
841
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
36212
|
|
|
1
|
|
|
|
|
33
|
|
7
|
1
|
|
|
1
|
|
9
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
727
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
792
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Catmandu::Fix::Base'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub emit { |
15
|
1
|
|
|
1
|
0
|
4203
|
my ($self, $fixer) = @_; |
16
|
1
|
|
|
|
|
8
|
my $path = $fixer->split_path($self->path); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$fixer->emit_create_path( |
19
|
|
|
|
|
|
|
$fixer->var, |
20
|
|
|
|
|
|
|
$path, |
21
|
|
|
|
|
|
|
sub { |
22
|
1
|
|
|
1
|
|
73
|
my $var = shift; |
23
|
1
|
|
|
|
|
6
|
"${var} = LWP::UserAgent->new->get(${var})->code if is_value(${var}) && length(${var});"; |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
78
|
); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Catmandu::Fix::uri_status_code - check the HTTP status of a uri |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
copy_field(url,status) |
35
|
|
|
|
|
|
|
uri_status_code(status) # status => '200' |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SEE ALSO |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
L<Catmandu::Fix> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |