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