in reply to Different compression behaviours with Compress::Zlib
Try using the inflate method as taken from the perldoc for
Compress::Zlib.
There is a difference in how the headers are written
which explains why the the second method is incompatible
with gzip.
Note that for zip file manipulation, the docs suggest using Archive::Zip which I would guess is a reason for the default behaviour. I'm still looking into this, but maybe this will help?
#!/usr/bin/perl use strict; use warnings; use Compress::Zlib; my $x = inflateInit() or die "Cannot create inflation stream"; my $input = ""; binmode STDIN; binmode STDOUT; my ($output, $status); while (read(STDIN, $input, 4096)) { ($output, $status) = $x->inflate(\$input); print $output if $status == Z_OK or $status == Z_STREAM_END; last if $status != Z_OK; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:x2 Different compression behaviours with Compress::Zlib
by grinder (Bishop) on Sep 11, 2001 at 00:51 UTC |