examples/io/gzip/gzcat

filter: Statementstmt 100% 17 / 17 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 92.8% 26 / 28 CC 1 SCAR 0.0
CC
1
Cov
92%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« examples/io/bzip2/bzcat ↑ Summary examples/io/bzip2/bzstream »
1 #!/usr/local/bin/perl
2  
3 3 ▶use IO::Uncompress::Gunzip qw( $GunzipError );
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict ;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings ;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 #die "Usage: gzcat file...\n"
8 # unless @ARGV ;
9  
10 3 my $file ;
11 my $buffer ;
12 3 my $s;
13  
14 3 ▶@ARGV = '-' unless @ARGV ;
Branch: 1 branch
BranchTrueFalseTotal
unless @ARGV 1 2 3
15  
16 3 foreach $file (@ARGV) {
17  
18 4 ▶ my $gz = new IO::Uncompress::Gunzip $file
Branch: 1 branch
BranchTrueFalseTotal
my $gz = "IO::Uncompress::Gunzip"->new($file) or die "Cannot open ${file}: $main::GunzipError\n" 4 0 4
19 or die "Cannot open $file: $GunzipError\n" ;
20  
21 4 ▶ print $buffer
Branch: 1 branch
BranchTrueFalseTotal
($s = $gz->read($buffer)) > 0 and do { print $buffer } 4 4 8
22 while ($s = $gz->read($buffer)) > 0 ;
23  
24 4 ▶ die "Error reading from $file: $GunzipError\n"
Branch: 1 branch
BranchTrueFalseTotal
if $s < 0 0 4 4
25 if $s < 0 ;
26  
27 4 $gz->close() ;
28 }
« examples/io/bzip2/bzcat ↑ Summary examples/io/bzip2/bzstream »