Move IO::Compress from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / IO-Compress / examples / io / bzip2 / bzcat
CommitLineData
25f0751f 1#!/usr/local/bin/perl
2
319fab50 3use IO::Uncompress::Bunzip2 qw( $Bunzip2Error );
25f0751f 4use strict ;
dc82791d 5use warnings ;
25f0751f 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
319fab50 18 my $gz = new IO::Uncompress::Bunzip2 $file
19 or die "Cannot open $file: $Bunzip2Error\n" ;
25f0751f 20
21 print $buffer
22 while ($s = $gz->read($buffer)) > 0 ;
23
319fab50 24 die "Error reading from $file: $Bunzip2Error\n"
25f0751f 25 if $s < 0 ;
26
27 $gz->close() ;
28}
29