Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 47280
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: SYSMON [...] cpan.org
Cc: sysmonblog [...] googlemail.com
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.10
Fixed in: (no value)



CC: sysmonblog [...] googlemail.com
Subject: Calling Storable::store with an HTTP::Response object fails.
I have some code that tries to cache, via Storable, the HTTP::Response object returned by LWP::UserAgent->get If a later call returns a 304, my code still wants to know what the original (and currently not modified) content/response was. Caching the HTTP::Response object achieved this, and worked fine under perl 5.8 on ubuntu intrepid. It breaks under 5.10 on ubuntu jaunty. I've attached a little script that reproduces the problem. In short, it's the CODE block in the HTTP::Response->{handlers}->{response_data} that Storable cannot handle. I'm willing to work on a failing test case, and potentially try putting a patch together, however I'm not clear IF this would be considered a bug? Is it sane to want to call Storable on an HTTP::Response object? If it is, I'm not sure what a suitable fix would be. For my uses, I already have the content, so I know I won't want to call the response_data callback in the future. So simply removing the callback handler suffices. However that won't work in general. LWP::UserAgent has a remove_handlers() method, but I don't see anything similar in HTTP::Response (or HTTP::Message) that would allow me to work around this in my code. If someone could point me at how it ought to be solved, I will try to code it in a patch.
Subject: storable_http_response
Download storable_http_response
application/octet-stream 368b

Message body not shown because it is not plain text.

My suggestion would be to set $Storable::forgive_me to a TRUE value before you call store() on the response object. That should make it more forgiving about stray code references. It might also be that these internal handlers ought to have been cleaned up by LWP if the response was completely received.
On Wed Jun 24 14:06:19 2009, GAAS wrote: Show quoted text
> It might also be that these internal handlers ought to have been > cleaned up by LWP if the response was completely received.
http://github.com/gisle/libwww-perl/commit/637f6c1544acdca5eb0e867dc6ec22441de524a0 is such a cleanup patch.