Subject: | Better async support. |
Currently you can intercept the actual request phase with a sub-class overriding _do_request(). This is nice, but not quite nice enough. The request phase needs to be broken into two distinct parts: preparing the request and parsing the response. _do_request() would wrap both of these phases and therefore keep current functionality.
Two new methods would need to be added, something like: _prepare_req(), and _parse_res(). They would return an HTTP::Request object, and take an HTTP::Response object respectivley. This allows an outside program to do the real HTTP interaction, for instance, POE::Component::Client::HTTP.
Thinking about this more, there is a good chance that _prepare_req() and _parse_res() should be public methods, so no underscore is required.
My program would effectivley do something like the following, instead of call get():
my $req = $agent->prepare_req( 'http://example.com' );
# do the requesting, populate HTTP::Response...
$agent->parse_res( $res );