NAME
IO::Lambda::HTTP - http requests lambda style
DESCRIPTION
The module exports a single condition http_request
that accepts a HTTP::Request
object and set of options as parameters. The condition returns either a HTTP::Response
on success, or an error string otherwise.
SYNOPSIS
use HTTP::Request;
use IO::Lambda qw(:all);
use IO::Lambda::HTTP qw(http_request);
lambda {
context shift;
http_request {
my $result = shift;
if ( ref($result)) {
print "good: ", length($result-> content), " bytes\n";
} else {
print "bad: $result\n";
}
}
}-> wait(
HTTP::Request-> new( GET => "http://www.perl.com/")
);
API
- http_request $HTTP::Request -> $HTTP::Response
-
http_request
is a lambda condition that acceptsHTTP::Request
object in the context. Returns either aHTTP::Response
object on success, or error string otherwise. - new $HTTP::Request :: () -> $HTTP::Response
BUGS
Non-blocking connects, and hence the module, don't work on win32 on perl5.8.X due to under-implementation in ext/IO.xs. They do work on 5.10 however.
SEE ALSO
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.