I would like to try mix of AnyEvent and Coro.
Is there a way to make the three lines between BEGIN and END more elegant/condensed?
use AnyEvent::HTTP;
use Coro;
async {
_
# BEGIN
my $READY = AnyEvent->condvar;
my $guard = http_request( GET => $url, $READY );
my ($data, $hHeaders ) = $READY->recv;
# END
…
}
WARNING: man AnyEvent
suggest slightly different way for Coro
integration but the general idea stays the same (comment added after accepted reply).
AnyEvent::HTTP::http_get "url", Coro::rouse_cb;
my ($body, $hdr) = Coro::rouse_wait;