Filewatcher File Search File Search
Content Search
» » » » » HTTP-Tiny-0.002.tar.gz » Content »
pkg://HTTP-Tiny-0.002.tar.gz:18761/HTTP-Tiny-0.002/  info  downloads


    HTTP::Tiny - A tiny HTTP client

    version 0.002

        use HTTP::Tiny;

        my $response = HTTP::Tiny->new->get('');

        print "$response->{status} $response->{reason}\n";

        while (my ($k, $v) = each %{$response->{headers}}) {
            for (ref $v eq 'ARRAY' ? @$v : $v) {
                print "$k: $_\n";

        print $response->{content} if defined $response->{content};

    This is a very simple HTTP/1.1 client, designed primarily for doing
    simple GET requests without the overhead of a large framework like

    It is more correct and more complete than HTTP::Lite. It supports
    proxies (currently only non-authenticating ones) and redirection. It
    also correctly resumes after EINTR.

    Additional documentation and improved tests will be forthcoming.

        $http = HTTP::Tiny->new( %attributes );

    This constructor returns a new HTTP::Tiny object. Valid attributes

    *   agent

        A user-agent string (defaults to 'HTTP::Tiny/$VERSION')

    *   default_headers

        A hashref of default headers to apply to requests

    *   max_redirect

        Maximum number of redirects allowed (defaults to 5)

    *   max_size

        Maximum response size (only when not using a data callback)

    *   proxy

        URL of a proxy server to use

    *   timeout

        Request timeout in seconds (default is 60)

        $response = $http->get($url);
        $response = $http->get($url, \%options);

    Executes a "GET" request for the given URL. Internally, it just calls
    "request()" with 'GET' as the method. See "request()" for valid options
    and a description of the response.

        $response = $http->request($method, $url);
        $response = $http->request($method, $url, \%options);

    Executes an HTTP request of the given method type ('GET', 'HEAD', 'PUT',
    etc.) on the given URL. A hashref of options may be appended to modify
    the request.

    Valid options are:

    *   headers

        A hashref containing headers to include with the request

    *   content

        A scalar to include as the body of the request OR a code reference
        that will be called iteratively to produce the body of the response

    *   data_callback

        A code reference that will be called with chunks of the response

    [XXX describe how callbacks work]

    The "response" method returns a hashref containing the response. The
    hashref will have the following keys:

    *   status

        The HTTP status code of the response

    *   reason

        The response phrase returned by the server

    *   content

        The body of the response. If the response does not have any content
        or if a data callback is provided to consume the response body, this
        will be the empty string

    *   headers

        A hashref of header fields. All header field names will be
        normalized to be lower case. If a header is repeated, the value will
        be an arrayref; it will otherwise be a scalar string containing the

    On an exception during the execution of the request, the "status" field
    will contain 599, and the "content" field will contain the text of the

    *   Christian Hansen <>

    *   David Golden <>

    This software is copyright (c) 2010 by Christian Hansen.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017