NAME
AnyEvent::HTTP::LWP::UserAgent - LWP::UserAgent interface but works using AnyEvent::HTTP
VERSION
version 0.01
SYNOPSIS
use AnyEvent::HTTP::LWP::UserAgent;
use Coro;
my $ua = AnyEvent::HTTP::LWP::UserAgent->new;
my @urls = (...);
my @coro = map {
async {
my $url = $_;
my $r = $ua->get($url);
print "url $url, content " . $r->content . "\n";
}
} @urls;
$_->join for @coro;
DESCRIPTION
When you use Coro you have a choice: you can use Coro::LWP or AnyEvent::HTTP (if you want to make asynchronous HTTP requests). If you use Coro::LWP, some modules may work incorrectly (for example Cache::Memcached) because of global change of IO::Socket behavior. AnyEvent::HTTP uses different programming interface, so you must change more of your old code with LWP::UserAgent (and HTTP::Request and so on), if you want to make asynchronous code.
AnyEvent::HTTP::LWP::UserAgent uses AnyEvent::HTTP inside but have an interface of LWP::UserAgent. You can safely use this module in Coro environment (and possibly in AnyEvent too).
LIMITATIONS AND DETAILS
You can use it only for HTTP(S)/1.0 requests.
Some features of LWP::UserAgent can be broken (protocols_forbidden
, conn_cache
or something else). Precise documentation and realization of these features will come in the future.
You can use some AnyEvent::HTTP global function and variables. But use agent
of UA instead of $AnyEvent::HTTP::USERAGENT
and max_redirect
instead of $AnyEvent::HTTP::MAX_RECURSE
.
SEE ALSO
http://github.com/tadam/AnyEvent-HTTP-LWP-UserAgent, Coro::LWP, AnyEvent::HTTP
AUTHOR
Yury Zavarin <yury.zavarin@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Yury Zavarin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.