line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::uri_status_code; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
83432
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
153371
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
942
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
36586
|
|
|
1
|
|
|
|
|
34
|
|
7
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
8
|
1
|
|
|
1
|
|
740
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
824
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Catmandu::Fix::Base'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub emit { |
15
|
1
|
|
|
1
|
0
|
4103
|
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
|
|
66
|
my $var = shift; |
23
|
1
|
|
|
|
|
6
|
"${var} = LWP::UserAgent->new->get(${var})->code if is_value(${var}) && length(${var});"; |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
45
|
); |
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; |