Why not just use the "callback" parameter of
request or
simple_request, and grab the data as it comes back?
Seems like you've reinvented a pretty big wheel. {grin}
From perldoc LWP::UserAgent...
The subroutine variant requires a reference to callback
routine as the second argument to request() and it can
also take an optional chuck size as the third argument.
This variant can be used to construct "pipe-lined" pro-
cessing, where processing of received chuncks can begin
before the complete data has arrived. The callback func-
tion is called with 3 arguments: the data received this
time, a reference to the response object and a reference
to the protocol object. The response object returned from
request() will have empty content. If the request fails,
then the the callback routine is called, and the
response->content might not be empty.
The request can be aborted by calling die() in the call-
back routine. The die message will be available as the
"X-Died" special response header field.
The library also allows you to use a subroutine reference
as content in the request object. This subroutine should
return the content (possibly in pieces) when called. It
should return an empty string when there is no more con-
tent.
-- Randal L. Schwartz, Perl hacker