473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help using Compress::Zlib::memGunzip()

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---
Jul 19 '05 #1
0 3504

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: samthemist | last post by:
For example: POST, GET www.thescripts.com etc What's the fastest way of doing this? As the program i'm making relys on speed, so the fastest way would help alot. I have tried an equivalent in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.