File Coverage

examples/io/bzip2/bzcat
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   18247 use IO::Uncompress::Bunzip2 qw( $Bunzip2Error );
  3         13  
  3         422  
4 3     3   20 use strict ;
  3         6  
  3         62  
5 3     3   11 use warnings ;
  3         6  
  3         5076  
6              
7             #die "Usage: gzcat file...\n"
8             # unless @ARGV ;
9              
10 3         521873 my $file ;
11             my $buffer ;
12 3         0 my $s;
13              
14 3 100       16 @ARGV = '-' unless @ARGV ;
15              
16 3         10 foreach $file (@ARGV) {
17              
18 4 50       108 my $gz = new IO::Uncompress::Bunzip2 $file
19             or die "Cannot open $file: $Bunzip2Error\n" ;
20              
21 4         12 print $buffer
22             while ($s = $gz->read($buffer)) > 0 ;
23              
24 4 50       11 die "Error reading from $file: $Bunzip2Error\n"
25             if $s < 0 ;
26              
27 4         24 $gz->close() ;
28             }