Subject: | HTTP::Message content 'CODE' reference |
I am working with LWP::UserAgent and am having trouble with the content
of HTTP::Message objects in the latest version of HTTP::Message. Since
I am sending very large files I am using the feature where the content
can be a 'CODE' reference which will be called when data is needed. My
code looks something like this:
my $reader = sub {
my $buf;
read F, $buf, 16384;
return $buf;
};
$request->content($reader);
When using HTTP::Message newer than cvs version 1.43, the above fails
with a "Not a SCALAR reference" inside the request method. In order to
make this work, I must use:
$request->content(\$reader);
Unfortunately, passing the reference-to-reference-to-CODE like this
fails with pre-1.43 HTTP::Message modules.
I believe something happened in the following changes:
http://cvs.sourceforge.net/viewcvs.py/libwww-perl/lwp5/lib/HTTP/Message.pm?r1=1.42&r2=1.43
but I have not isolated the exact problem.