Please could someone help solve a problem I have using the Compress::Zlib module? (apologies for length of post)
Background:
OS: AIX
I am trying to unzip a .gz file that is too large for my version of gzip (117086673 bytes). Gzip just returns that the file is 'too large', so I thought Perl could help out.
I tried the following code (cribbed from CPAN):
my $buffer; my $gz = gzopen ("$input_dir/$file", 'rb') || die "Can't open gz $file\n"; while ($gz -> gzread ($buffer) > 0) { syswrite DATAFILE, $buffer, 4096; } $gz -> gzclose; close DATAFILE;
The result was an uncompressed, but uncomplete output file. I thought maybe the buffer wasn't flushing at the end so I also tried (courtesy of CPAN):
open (GZIPFILE, "$input_dir/$file") || warn "Can't open zip input file: $file: $!"; binmode GZIPFILE; open (DATAFILE, ">>$input_dir/$dat_file") || warn "Can't open uncompressed data file: $dat_file: $!"; my $deflator = deflateInit() or die "Cannot create a deflation stream\ +n" ; my ($output, $status); while (<GZIPFILE>) { ($output, $status) = $deflator->deflate($_) ; $status == Z_OK or die "deflation failed\n" ; print (DATAFILE $output) ; } ($output, $status) = $deflator->flush() ; $status == Z_OK or die "deflation failed\n" ; print (DATAFILE $output) ;
The result was again a partially uncompressed file. Is there a maximum file size that Zlib can handle? If there is, is it configurable? If not, does anybody know what I am doing wrong?
Any other suggestions?
Thanks,
Erm.

In reply to Zlib is stopping me leaving work early and going to the pub... by erm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.