Help using Compress::Zlib::memGunzip()

Discussion in 'Perl' started by Tony, Sep 5, 2003.

  1. Tony

    Tony Guest

    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---
     
    Tony, Sep 5, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ixtahdoom
    Replies:
    0
    Views:
    574
    ixtahdoom
    Jun 15, 2004
  2. Mike
    Replies:
    1
    Views:
    1,075
    John Harrison
    Aug 3, 2003
  3. ngoc

    error in Compress-Zlib-1.32

    ngoc, Dec 16, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    116
  4. Replies:
    1
    Views:
    136
  5. Replies:
    5
    Views:
    619
Loading...

Share This Page