| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package URI::Fetch::Response; |
|
2
|
|
|
|
|
|
|
$URI::Fetch::Response::VERSION = '0.14'; |
|
3
|
1
|
|
|
1
|
|
9
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
541
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
|
7
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
8
|
0
|
|
|
|
|
|
my $feed = bless { }, $class; |
|
9
|
0
|
|
|
|
|
|
$feed; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _var { |
|
13
|
0
|
|
|
0
|
|
|
my $feed = shift; |
|
14
|
0
|
|
|
|
|
|
my $var = shift; |
|
15
|
0
|
0
|
|
|
|
|
$feed->{$var} = shift if @_; |
|
16
|
0
|
|
|
|
|
|
$feed->{$var}; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
1
|
|
sub status { shift->_var('status', @_) } |
|
20
|
0
|
|
|
0
|
1
|
|
sub http_status { shift->_var('http_status', @_) } |
|
21
|
0
|
|
|
0
|
1
|
|
sub http_response { shift->_var('http_response', @_) } |
|
22
|
0
|
|
|
0
|
1
|
|
sub etag { shift->_var('etag', @_) } |
|
23
|
0
|
|
|
0
|
1
|
|
sub last_modified { shift->_var('last_modified', @_) } |
|
24
|
0
|
|
|
0
|
1
|
|
sub uri { shift->_var('uri', @_) } |
|
25
|
0
|
|
|
0
|
1
|
|
sub content { shift->_var('content', @_) } |
|
26
|
0
|
|
|
0
|
1
|
|
sub content_type { shift->_var('content_type', @_) } |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub is_success { |
|
29
|
0
|
|
|
0
|
1
|
|
my $response = shift; |
|
30
|
0
|
0
|
|
|
|
|
if ($response->http_response) { |
|
31
|
0
|
0
|
0
|
|
|
|
return 1 if $response->http_response->code == 304 |
|
32
|
|
|
|
|
|
|
&& defined($response->content); |
|
33
|
0
|
|
|
|
|
|
return $response->http_response->is_success; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
0
|
|
|
|
|
|
return 1; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is_redirect { |
|
39
|
0
|
|
|
0
|
1
|
|
my $response = shift; |
|
40
|
0
|
0
|
|
|
|
|
return $response->http_response->is_redirect if $response->http_response; |
|
41
|
0
|
|
|
|
|
|
return; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub is_error { |
|
45
|
0
|
|
|
0
|
1
|
|
my $response = shift; |
|
46
|
0
|
0
|
|
|
|
|
return $response->http_response->is_error if $response->http_response; |
|
47
|
0
|
|
|
|
|
|
return; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
__END__ |