문제

I have a problem with uncompressing .bz package in memory. My script used to download gzip package and it uncompressed in the memory and sent its output to content().

This was working before with gzip but unfortunately it does not understand bzip2 package:

$mech = WWW::Mechanize->new;
$mech->get("$url/pkg.gz");
$packages = Compress::Zlib::memGunzip($mech->content())

I tried to look for equivalent compresspackage without a success. How I can implement this simple script with bzip2 package?

도움이 되었습니까?

해결책

use IO::Compress::Bunzip2 qw( bunzip2 $Bunzip2Error );

bunzip2(\$mech->content() => \my $packages)
   or die("bunzip2 failed: $Bunzip2Error\n");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top