NAME
IO::Lambda::HTTPS - https requests lambda style
DESCRIPTION
The module exports a single lambda https_request
that behaves exactly as IO::Lambda::HTTP::http_request
. See IO::Lambda::HTTP for detailed explanation of the behavior.
SYNOPSIS
use HTTP::Request;
use IO::Lambda qw(:all);
use IO::Lambda::HTTPS qw(https_request);
my $req = HTTP::Request-> new( GET => "https://addons.mozilla.org/en-US/firefox");
$req-> protocol('HTTP/1.1');
$req-> headers-> header( Host => $req-> uri-> host);
$req-> headers-> header( Connection => 'close');
this lambda {
context shift;
https_request {
my $result = shift;
if ( ref($result)) {
print "good:", length($result-> content), "\n";
} else {
print "bad:$result\n";
}
}
};
this-> wait($req);
API
- https_request $HTTP::Request
-
https_request
is a lambda predicate that acceptsHTTP::Request
object in the context. Returns either aHTTP::Response
object on success, or error string otherwise. - new $HTTP::Request
-
Stores
HTTP::Request
object and returns a new lambda that will finish when the request associated with it completes. The lambda callback will be passed either aHTTP::Response
object on success, or error string otherwise.
SEE ALSO
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.