|
NAMEFurl - Lightning-fast URL fetcherSYNOPSISuse Furl; my $furl = Furl->new( agent => 'MyGreatUA/2.0', timeout => 10, ); my $res = $furl->get('http://example.com/'); die $res->status_line unless $res->is_success; print $res->content; my $res = $furl->post( 'http://example.com/', # URL [...], # headers [ foo => 'bar' ], # form data (HashRef/FileHandle are also okay) ); # Accept-Encoding is supported but optional $furl = Furl->new( headers => [ 'Accept-Encoding' => 'gzip' ], ); my $body = $furl->get('http://example.com/some/compressed'); DESCRIPTIONFurl is yet another HTTP client library. LWP is the de facto standard HTTP client for Perl 5, but it is too slow for some critical jobs, and too complex for weekend hacking. Furl resolves these issues. Enjoy it!INTERFACEClass Methods"Furl->new(%args | \%args) :Furl"Creates and returns a new Furl client with %args. Dies on errors. %args might be:
Instance Methods"$furl->request([$request,] %args) :Furl::Response"Sends an HTTP request to a specified URL and returns a instance of Furl::Response. %args might be:
If the number of arguments is an odd number, this method assumes that the first argument is an instance of "HTTP::Request". Remaining arguments can be any of the previously describe values (but currently there's no way to really utilize them, so don't use it) my $req = HTTP::Request->new(...); my $res = $furl->request($req); You can also specify an object other than HTTP::Request (e.g. Furl::Request), but the object must implement the following methods:
These must return the same type of values as their counterparts in "HTTP::Request". You must encode all the queries or this method will die, saying "Wide character in ...". "$furl->get($url :Str, $headers :ArrayRef[Str] )" This is an easy-to-use alias to "request()", sending the "GET" method. "$furl->head($url :Str, $headers :ArrayRef[Str] )" This is an easy-to-use alias to "request()", sending the "HEAD" method. "$furl->post($url :Str, $headers :ArrayRef[Str], $content :Any)" This is an easy-to-use alias to "request()", sending the "POST" method. "$furl->put($url :Str, $headers :ArrayRef[Str], $content :Any)" This is an easy-to-use alias to "request()", sending the "PUT" method. "$furl->delete($url :Str, $headers :ArrayRef[Str] )" This is an easy-to-use alias to "request()", sending the "DELETE" method. "$furl->env_proxy()" Loads proxy settings from $ENV{HTTP_PROXY} and $ENV{NO_PROXY}. TIPS
FAQ
AUTHORTokuhiro Matsuno <tokuhirom@gmail.com>Fuji, Goro (gfx) THANKS TOKazuho Okumala mattn lestrrat walf443 lestrrat audreyt SEE ALSOLWPIO::Socket::SSL Furl::HTTP Furl::Response LICENSECopyright (C) Tokuhiro Matsuno.This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |