AnyEvent-HTTP-LWP-UserAgent
view release on metacpan or search on metacpan
lib/AnyEvent/HTTP/LWP/UserAgent.pm view on Meta::CPAN
$response->header("Client-Warning" => $@);
}
next CHALLENGE;
}
}
unless ($class->can("authenticate")) {
$response->header("Client-Warning" =>
"Unsupported authentication scheme '$scheme'");
next CHALLENGE;
}
# TODO: Maybe able to be more asynchronous
$cv->send($class->authenticate($self, $proxy, $challenge, $response,
$request, $arg, $size)); return;
}
$cv->send($response); return
}
$cv->send($response); return;
});
return $cv;
}
lib/AnyEvent/HTTP/LWP/UserAgent.pm view on Meta::CPAN
print "url $url, content " . $r->content . "\n";
$cv->end;
});
}
$cv->end;
$cv->recv;
=head1 DESCRIPTION
When you use Coro you have a choice: you can use L<Coro::LWP> or L<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).
In plain AnyEvent, you may use _async methods.
They don't make blocking wait but return condition variable.
So, you can avoid recursive blocking wait error.
=head1 SOME METHODS
lib/AnyEvent/HTTP/LWP/UserAgent.pm view on Meta::CPAN
C<conn_cache> for C<$ua>. If you just change C<total_capacity> of old C<conn_cache>
it will not change anything.
=back
=head1 ASYNC METHODS
The following methods are async version of corresponding methods w/o _async suffix.
Parameters are identical as originals.
However, return value becomes condition variable.
You can use it in a synchronous way by blocking wait
$ua->simple_request_async(@args)->recv
or in an asynchronous way, also.
$ua->simple_request_async(@args)->cb(sub { ... });
=over 4
=item simple_request_async
=item request_async
=item get_async
( run in 0.380 second using v1.01-cache-2.11-cpan-0d8aa00de5b )