line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
193378
|
use strict; |
|
2
|
|
|
|
|
32
|
|
|
2
|
|
|
|
|
57
|
|
2
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
120
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package HTTP::Tiny::UA; |
5
|
|
|
|
|
|
|
# ABSTRACT: Higher-level UA features for HTTP::Tiny |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
953
|
use superclass 'HTTP::Tiny' => 0.036; |
|
2
|
|
|
|
|
9324
|
|
|
2
|
|
|
|
|
10
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
74399
|
use HTTP::Tiny::UA::Response; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
189
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#pod =method new |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod $http = HTTP::Tiny::UA->new( %attributes ); |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod This is inherited from L. The only difference so far is that |
18
|
|
|
|
|
|
|
#pod C will be C. |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =for :list |
21
|
|
|
|
|
|
|
#pod * C |
22
|
|
|
|
|
|
|
#pod A user-agent string (defaults to 'HTTP-Tiny-UA/$VERSION'). If C ends in a space character, the default user-agent string is appended. |
23
|
|
|
|
|
|
|
#pod * C |
24
|
|
|
|
|
|
|
#pod An instance of L or equivalent class that supports the C and C methods |
25
|
|
|
|
|
|
|
#pod * C |
26
|
|
|
|
|
|
|
#pod A hashref of default headers to apply to requests |
27
|
|
|
|
|
|
|
#pod * C |
28
|
|
|
|
|
|
|
#pod The local IP address to bind to |
29
|
|
|
|
|
|
|
#pod * C |
30
|
|
|
|
|
|
|
#pod Maximum number of redirects allowed (defaults to 5) |
31
|
|
|
|
|
|
|
#pod * C |
32
|
|
|
|
|
|
|
#pod Maximum response size (only when not using a data callback). If defined, |
33
|
|
|
|
|
|
|
#pod responses larger than this will return an exception. |
34
|
|
|
|
|
|
|
#pod * C |
35
|
|
|
|
|
|
|
#pod URL of a proxy server to use (default is C<$ENV{http_proxy}> if set) |
36
|
|
|
|
|
|
|
#pod * C |
37
|
|
|
|
|
|
|
#pod List of domain suffixes that should not be proxied. Must be a comma-separated string or an array reference. (default is C<$ENV{no_proxy}>) |
38
|
|
|
|
|
|
|
#pod * C |
39
|
|
|
|
|
|
|
#pod Request timeout in seconds (default is 60) |
40
|
|
|
|
|
|
|
#pod * C |
41
|
|
|
|
|
|
|
#pod A boolean that indicates whether to validate the SSL certificate of an C |
42
|
|
|
|
|
|
|
#pod connection (default is false) |
43
|
|
|
|
|
|
|
#pod * C |
44
|
|
|
|
|
|
|
#pod A hashref of C options to pass through to L |
45
|
|
|
|
|
|
|
#pod |
46
|
|
|
|
|
|
|
#pod See L for more on the |
47
|
|
|
|
|
|
|
#pod C and C attributes. |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod =method get|head|put|post|post_form|mirror|delete |
50
|
|
|
|
|
|
|
#pod |
51
|
|
|
|
|
|
|
#pod These methods are inherited from L and work the same, except they |
52
|
|
|
|
|
|
|
#pod invoke the L method and return a |
53
|
|
|
|
|
|
|
#pod L object. |
54
|
|
|
|
|
|
|
#pod |
55
|
|
|
|
|
|
|
#pod =method request |
56
|
|
|
|
|
|
|
#pod |
57
|
|
|
|
|
|
|
#pod my $res = HTTP::Tiny->new->get( $url ); |
58
|
|
|
|
|
|
|
#pod |
59
|
|
|
|
|
|
|
#pod Just like L, but returns a |
60
|
|
|
|
|
|
|
#pod L object. All other C, C, etc. methods |
61
|
|
|
|
|
|
|
#pod eventually invoke this one so all such methods return response objects now. |
62
|
|
|
|
|
|
|
#pod |
63
|
|
|
|
|
|
|
#pod =cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub request { |
66
|
2
|
|
|
2
|
1
|
13323
|
my ( $self, @args ) = @_; |
67
|
2
|
|
|
|
|
15
|
my $res = $self->SUPER::request(@args); |
68
|
2
|
|
|
|
|
54742
|
return HTTP::Tiny::UA::Response->new($res); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et: |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |