Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: .gz inside a zip

by huck (Prior)
on Sep 11, 2017 at 02:10 UTC ( [id://1199059]=note: print w/replies, xml ) Need Help??


in reply to .gz inside a zip

You were missing a my and a right bracket too

#!/home/cnda/master/bin/perl/bin/perl use strict; use warnings; use IO::Compress::Zip; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; my @list=('E:/synctest/y2017.zip'); foreach my $path (@list){ my $zip = Archive::Zip->new(); unless ( $zip->read( $path ) == AZ_OK ) { die 'read error';} my @membersfn=$zip->memberNames(); for my $pathAndFilename (@membersfn) { print "$pathAndFilename\n"; my $member = $zip->memberNamed( $pathAndFilename ); if ($member) { $member->desiredCompressionMethod( COMPRESSION_STORED ); my $status = $member->rewindData(); die "error $status" unless $status == AZ_OK; my $membdata=''; while (!$member->readIsDone()){ my ( $bufferRef, $status ) = $member->readChunk(4*1024); die "error $status" if $status != AZ_OK && $status != AZ_STREAM_END; $membdata.=$$bufferRef; } # ! done my $flatdata; gunzip \$membdata=>\$flatdata; unless (defined $flatdata) {die "IO::Uncompress::Gunzip+un +zip failed: $GunzipError\n"; } print $flatdata."\n"; } # member }# pathAndFilename } # path

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1199059]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found