Move IO::Compress from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / IO-Compress / examples / io / gzip / gzcat
CommitLineData
25f0751f 1#!/usr/local/bin/perl
2
3use IO::Uncompress::Gunzip qw( $GunzipError );
4use strict ;
5use warnings ;
6
7#die "Usage: gzcat file...\n"
8# unless @ARGV ;
9
10my $file ;
11my $buffer ;
12my $s;
13
14@ARGV = '-' unless @ARGV ;
15
16foreach $file (@ARGV) {
17
18 my $gz = new IO::Uncompress::Gunzip $file
19 or die "Cannot open $file: $GunzipError\n" ;
20
21 print $buffer
22 while ($s = $gz->read($buffer)) > 0 ;
23
24 die "Error reading from $file: $GunzipError\n"
25 if $s < 0 ;
26
27 $gz->close() ;
28}
29