File Coverage

examples/io/gzip/gzcat
Criterion Covered Total %
statement 17 17 100.0
branch 4 6 66.6
condition n/a
subroutine 3 3 100.0
pod n/a
total 24 26 92.3


line stmt bran cond sub pod time code
1             #!/usr/local/bin/perl
2              
3 3     3   19639 use IO::Uncompress::Gunzip qw( $GunzipError );
  3         12  
  3         404  
4 3     3   24 use strict ;
  3         5  
  3         77  
5 3     3   14 use warnings ;
  3         4  
  3         5589  
6              
7             #die "Usage: gzcat file...\n"
8             # unless @ARGV ;
9              
10 3         667483 my $file ;
11             my $buffer ;
12 3         0 my $s;
13              
14 3 100       20 @ARGV = '-' unless @ARGV ;
15              
16 3         9 foreach $file (@ARGV) {
17              
18 4 50       116 my $gz = new IO::Uncompress::Gunzip $file
19             or die "Cannot open $file: $GunzipError\n" ;
20              
21 4         24 print $buffer
22             while ($s = $gz->read($buffer)) > 0 ;
23              
24 4 50       26 die "Error reading from $file: $GunzipError\n"
25             if $s < 0 ;
26              
27 4         30 $gz->close() ;
28             }