use LWP::UserAgent; use Compress::Raw::Zlib; sub mkGunz { my $gun = new Compress::Raw::Zlib::Inflate( WindowBits => WANT_GZIP); return sub { my $out; my $status = $gun->inflate($_[0], $out); if ($status == Z_OK || $status == Z_STREAM_END) { print $out; } else { die $status; } } ; } my $ua = LWP::UserAgent->new; my $URL = 'http://whatever/'; my $res = $ua->request(HTTP::Request->new(GET => $URL), mkGunz());