LWP/Protocol/http.pm

"Derek Boonstra" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <0B66C30E888A9E4C9A34C20CF814AE1F01E60ACF@ex9.hostedexchange.local>
 
I bumped into this snip on perlmonks.
 
http://www.perlmonks.org/?node_id=621885
    >> my $browser = LWP::UserAgent->new();
    >> my $response = $browser->request($request, \&sendthis);
Its pretty nice way to post large datafiles via without buffering
hundreds of megs in local RAM.  I hadn't thought of this from the
perldoc.
From the perldoc LWP::UserAgent
>> $ua->request( $request, $content_cb, $read_size_hint )
But, it doesn't work :(
HTTP::Message doesnt allow you to add content that is of non scalar
reference.
LWP::Protocol::http only uses the request content from HTTP::Message (
it mostly ignores arg[1] from the origial request call )
Even if HTTP::Message could take something like $request->content(
\&code ) the http.pm would die suddenly from this.
 >> $content_ref = $$content_ref if ref($$content_ref);

  unbelievably, four lines after this  it says:

 >> if ( ref($content_ref) eq 'CODE' ))

... if that statement would ever be true, the previous statement would
be a run time error ..

Anywhoo,  for those that are amused, attached are a couple lame patches
that seem to work.
http10.pm-patch (application/octet-stream, 823 B) - not displayed
http.pm-patch (application/octet-stream, 704 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.