| 1 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | package HTTP::Tiny::UA; | ||
| 5 | # ABSTRACT: Higher-level UA features for HTTP::Tiny | ||
| 6 | |||
| 7 | 2 | our $VERSION = '0.006'; | |
| 8 | |||
| 9 | 2 | ▶ | use superclass 'HTTP::Tiny' => 0.036; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 2 | ▶ | use HTTP::Tiny::UA::Response; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | #pod =method new | ||
| 14 | #pod | ||
| 15 | #pod $http = HTTP::Tiny::UA->new( %attributes ); | ||
| 16 | #pod | ||
| 17 | #pod This is inherited from L<HTTP::Tiny>. The only difference so far is that | ||
| 18 | #pod C<agent> will be C<HTTP-Tiny-UA/$VERSION>. | ||
| 19 | #pod | ||
| 20 | #pod =for :list | ||
| 21 | #pod * C<agent> | ||
| 22 | #pod A user-agent string (defaults to 'HTTP-Tiny-UA/$VERSION'). If C<agent> ends in a space character, the default user-agent string is appended. | ||
| 23 | #pod * C<cookie_jar> | ||
| 24 | #pod An instance of L<HTTP::CookieJar> or equivalent class that supports the C<add> and C<cookie_header> methods | ||
| 25 | #pod * C<default_headers> | ||
| 26 | #pod A hashref of default headers to apply to requests | ||
| 27 | #pod * C<local_address> | ||
| 28 | #pod The local IP address to bind to | ||
| 29 | #pod * C<max_redirect> | ||
| 30 | #pod Maximum number of redirects allowed (defaults to 5) | ||
| 31 | #pod * C<max_size> | ||
| 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<proxy> | ||
| 35 | #pod URL of a proxy server to use (default is C<$ENV{http_proxy}> if set) | ||
| 36 | #pod * C<no_proxy> | ||
| 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<timeout> | ||
| 39 | #pod Request timeout in seconds (default is 60) | ||
| 40 | #pod * C<verify_SSL> | ||
| 41 | #pod A boolean that indicates whether to validate the SSL certificate of an C<https> | ||
| 42 | #pod connection (default is false) | ||
| 43 | #pod * C<SSL_options> | ||
| 44 | #pod A hashref of C<SSL_*> options to pass through to L<IO::Socket::SSL> | ||
| 45 | #pod | ||
| 46 | #pod See L<SSL SUPPORT in HTTP::Tiny|HTTP::Tiny/SSL SUPPORT> for more on the | ||
| 47 | #pod C<verify_SSL> and C<SSL_options> attributes. | ||
| 48 | #pod | ||
| 49 | #pod =method get|head|put|post|post_form|mirror|delete | ||
| 50 | #pod | ||
| 51 | #pod These methods are inherited from L<HTTP::Tiny> and work the same, except they | ||
| 52 | #pod invoke the L<HTTP::Tiny::UA request|/request> method and return a | ||
| 53 | #pod L<HTTP::Tiny::UA::Response> 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<HTTP::Tiny::request|HTTP::Tiny/request>, but returns a | ||
| 60 | #pod L<HTTP::Tiny::UA::Response> object. All other C<get>, C<post>, etc. methods | ||
| 61 | #pod eventually invoke this one so all such methods return response objects now. | ||
| 62 | #pod | ||
| 63 | #pod =cut | ||
| 64 | |||
| 65 | 2 | ▶ | sub request { |
|
Subroutine
request: called CC=1 SCAR=0.0
Pod
documented
| |||
| 66 | 2 | my ( $self, @args ) = @_; | |
| 67 | 2 | my $res = $self->SUPER::request(@args); | |
| 68 | 2 | return HTTP::Tiny::UA::Response->new($res); | |
| 69 | } | ||
| 70 | |||
| 71 | 2 | 1; | |
| 72 | |||
| 73 | |||
| 74 | # vim: ts=4 sts=4 sw=4 et: | ||
| 75 | |||
| 76 | __END__ | ||