lostcause has asked for the wisdom of the Perl Monks concerning the following question:
Or using the IO-Zlib library:#!/usr/bin/perl -w use strict; use Compress::Zlib; my ($tempFilename2, $tempFilename1, $gz, $buffer, $gzerrno); $tempFilename1 = "yeast.aa.Z"; $tempFilename2 = "yeast.aa"; open (GZIPFILE, "$tempFilename1") || warn "Can't open zip input file: $tempFilename1: $!"; binmode GZIPFILE; open (DATAFILE, ">>$tempFilename2") || warn "Can't open uncompressed data file: $tempFilename2: $!"; binmode DATAFILE; my $x = inflateInit() or die "Cannot create a inflation stream\n" ; my $input = '' ; my ($output, $status) ; while (read(GZIPFILE, $input, 4096)) { ($output, $status) = $x->inflate(\$input) ; print DATAFILE $output if $status == Z_OK or $status == Z_STREAM_END ; last if $status != Z_OK ; } die "inflation failed\n" unless $status == Z_STREAM_END ;
#!/usr/bin/perl -w use strict; use IO::Zlib; my $tempFilename1 = "yeast.aa.Z"; my $tempFilename2 = "yeast.aa"; open (DATAFILE, ">>$tempFilename2") || warn "Can't open uncompressed data file: $tempFilename2: $!"; my $fh = new IO::Zlib; if ($fh->open("$tempFilename1", "rb")) { print DATAFILE <$fh>; $fh->close; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uncompressing a foo.Z file
by bart (Canon) on Aug 31, 2002 at 12:19 UTC | |
by sauoq (Abbot) on Aug 31, 2002 at 17:55 UTC | |
|
Re: uncompressing a foo.Z file
by sauoq (Abbot) on Aug 30, 2002 at 23:51 UTC |