Expander/Plugin/ApplicationBzip2.pm

filter: Statementstmt 100% 29 / 29 Branchbran 62.5% 5 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 87.2% 41 / 47 CC 6 SCAR 13.5
CC
6
Cov
90%
expand
6.2
BEGIN
1.0
BEGIN
1.0
CRAP 3.9
« Expander.pm ↑ Summary Expander/Plugin/ApplicationGzip.pm »
1 package MIME::Expander::Plugin::ApplicationBzip2;
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.01';
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/bzip2
11 application/x-bzip2
12 )]);
13  
14 4 ▶use IO::Uncompress::Bunzip2;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 sub expand {
17 3 ▶ my $self = shift;
Subroutine expand: called CC=6 SCAR=18.3
Pod undocumented
18 3 my $contents = shift;
19 3 my $callback = shift;
20 3 my $c = 0;
21  
22 3 ▶ my $z = IO::Uncompress::Bunzip2->new(
Branch: 2 branches
BranchTrueFalseTotal
my $z = "IO::Uncompress::Bunzip2"->new(ref $contents eq "SCALAR" ? $contents : \$contents, "Append", 1) or die "bzip2 failed: $IO::Uncompress::Bunzip2::Bunzip2Error" 0 3 3
ref $contents eq 'SCALAR' ? : 3 0 3
23 ref $contents eq 'SCALAR' ? $contents : \$contents
24 , Append => 1)
25 or die "bzip2 failed: $IO::Uncompress::Bunzip2::Bunzip2Error";
26  
27 3 my $buf;
28 3 ▶ 1 while( 0 < $z->read($buf) );
Branch: 1 branch
BranchTrueFalseTotal
0 < $z->read($buf) and do { '???' } 3 3 6
29
30 3 ▶ my $h = $z->getHeaderInfo || {};
Condition50%1/2
$z->getHeaderInfo || {}
l!l
30
MC/DC0%0/1
$z->getHeaderInfo || {}
$z->getHeaderInfo
Truth table50%1/2
A
A= $z->getHeaderInfo
Aresult
11
00
31 $callback->( \$buf, {
32 filename => $h->{Name},
33 3 ▶ } ) if( ref $callback eq 'CODE' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $callback eq "CODE" 3 0 3
34 3 ++$c;
35  
36 3 return $c;
37 }
38  
39 4 1;
40 __END__
« Expander.pm ↑ Summary Expander/Plugin/ApplicationGzip.pm »