erm has asked for the wisdom of the Perl Monks concerning the following question:
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):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 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?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) ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Zlib is stopping me leaving work early and going to the pub...
by hannibal (Scribe) on Apr 06, 2001 at 19:33 UTC | |
|
Re: Zlib is stopping me leaving work early and going to the pub...
by Malkavian (Friar) on Apr 06, 2001 at 19:58 UTC | |
|
Re: Zlib is stopping me leaving work early and going to the pub...
by erm (Initiate) on Apr 06, 2001 at 20:43 UTC |