Dear Uday, I don't know. May be, but if so, I am not sure how. You see, I know very little about the inner workings of all these complex packages. (As an aside, this is a testimony to the value of OOP. Without any knowledge of the implementation, I am able to use it.)
So, the question is how do I invoke such a deflating package where the ':content_file' => $filename hash short circuits and directs the response directly to a file. I am sure that the deflating package is invoked by the $response->decoded_content method. But I don’t know about any hash that will tell the 'get' method to deflate the response on the way to $filename. I can of course use the decoded_content method and save the result to file. But I was hoping that there is a method that will do it for me... Thanks! Meir > -----Original Message----- > From: Uday Bhaskar [mailto:uday.bhas...@gmail.com] > Sent: Sunday, April 15, 2012 6:13 AM > To: Meir Guttman > Cc: Libwww Perl > Subject: Re: How to deflate a ':content_file' response saved to a file > > Are you thinking about use IO::Uncompress::Unzip ? > > Thanks > Uday > > On Sun, Apr 15, 2012 at 1:55 AM, Meir Guttman <m...@guttman.co.il> > wrote: > > I would like to download gzip (or similarly encoded) HTML content. If > > I keep the response in a variable, I can decode the contents using > the > > 'decoded_content' method, as follows (Just extracted from a working > > script, but not tested): > > > > #################################### > > use strict; > > use warnings; > > use base 'HTTP::Message'; > > use LWP::UserAgent > > > > my $can_accept = HTTP::Message::decodable; > > > > my $ua = LWP::UserAgent->new; > > my $response = $ua->get($uri, 'Accept-Encoding' => > > $can_accept); > > print $response->decoded_content, "\n"; > > #################################### > > > > On the other hand, another variation of the 'get' method can save a > > response to a file, as in: > > > > $ua->get($url, ':content_file' => $filename); > > > > But I couldn't find a way to first deflate the contents that is saved > > to file. > > > > Can someone point me to the right part of the LWP package? > > > > Thanks, > > Meir > >