Expander/Plugin/ApplicationGzip.pm

filter: Statementstmt 100% 30 / 30 Branchbran 66.6% 4 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 89.1% 41 / 46 CC 5 SCAR 11.1
CC
5
Cov
92%
expand
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Expander/Plugin/ApplicationBzip2.pm ↑ Summary Expander/Guess/FileName.pm »
1 package MIME::Expander::Plugin::ApplicationGzip;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 $VERSION = '0.02';
7  
8 4 ▶use parent qw(MIME::Expander::Plugin);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 __PACKAGE__->mk_classdata('ACCEPT_TYPES' => [qw(
10 application/gzip
11 )]);
12  
13 4 ▶use IO::Uncompress::Gunzip;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 7 ▶sub expand {
Subroutine expand: called CC=5 SCAR=16.3
Pod undocumented
16 7 my $self = shift;
17 7 my $part = shift;
18 7 my $callback = shift;
19 7 my $c = 0;
20  
21 7 my $contents = $part->body;
22 7 ▶ my $z = IO::Uncompress::Gunzip->new(
Branch: 1 branch
BranchTrueFalseTotal
my $z = "IO::Uncompress::Gunzip"->new(\$contents, "Append", 1) or die "gunzip failed: $IO::Uncompress::Gunzip::GunzipError" 7 0 7
23 \$contents, Append => 1
24 ) or die "gunzip failed: $IO::Uncompress::Gunzip::GunzipError";
25  
26 7 my $buf;
27 7 ▶ 1 while( 0 < $z->read($buf) );
Branch: 1 branch
BranchTrueFalseTotal
0 < $z->read($buf) and do { '???' } 17 7 24
28
29 7 ▶ my $h = $z->getHeaderInfo || {};
Condition50%1/2
$z->getHeaderInfo || {}
l!l
70
MC/DC0%0/1
$z->getHeaderInfo || {}
$z->getHeaderInfo
Truth table50%1/2
A
A= $z->getHeaderInfo
Aresult
11
00
30 $callback->( \$buf, {
31 filename => $h->{Name},
32 7 ▶ } ) if( ref $callback eq 'CODE' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $callback eq "CODE" 7 0 7
33 7 ++$c;
34  
35 7 return $c;
36 }
37  
38 4 1;
39 __END__
« Expander/Plugin/ApplicationBzip2.pm ↑ Summary Expander/Guess/FileName.pm »