Help using Compress::Zlib::memGunzip()

T

Tony

Hello,

Any assistance would be appreciated:

As the subject suggests I am trying to gunzip files using the
Compress::Zlib module. The following is basically the code that I am
working with:

------------------------------------------------
------------------------------------------------

#!/usr/bin/perl -w
use Compress::Zlib;


my $item;
my $zipFileBuffer;
my $gz;
my @listOfZippedFiles;
my $loc_directory;

$loc_directory = "/home/testdirectory";

@listOfZippedFiles = glob("$loc_directory/*.Z");

foreach $item (@listOfZippedFiles)
{
print "Unzipping: $item\n";

$gz = gzopen($item) or die "Can not gzopen \n";
$gz->gzread($zipFileBuffer) or die "Can not read in gzip file\n";

Compress::Zlib::memGunzip($zipFileBuffer) or die "unable to
gunzip\n";

$gz->gzclose();
}

exit;

------------------------------------------------
------------------------------------------------

Output:
- die message occurs on the Compress::Zlib::memGunzip()
- I printed out the size read at $gz->gzread($zipFileBuffer) and it
is using the default value of 4096 bytes - I thought if the file is
greater then the 4096 default buffer size it would adjust itself so
that the entire file is read in.

I adjusted the size of the default buffer size to match the file
size and the Compress::Zlib::memGunzip() still throwed the die
statement....

Assumptions:
1. the entire file is buffered into memory
2. the buffered data is uncompressed via a file pointer being pointed
at by $gz.

Thanks,
Tony---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top