Expander/Plugin/ApplicationTar.pm

filter: Statementstmt 100% 31 / 31 Branchbran 75.0% 6 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 90.3% 47 / 52 CC 6 SCAR 12.7
CC
6
Cov
93%
expand
6.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.6
« Expander/Plugin/ApplicationGzip.pm ↑ Summary Expander/Guess/FileName.pm »
1 package MIME::Expander::Plugin::ApplicationTar;
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/tar
11 application/x-tar
12 )]);
13  
14 4 ▶use Archive::Tar;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use IO::Scalar;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 sub expand {
18 4 ▶ my $self = shift;
Subroutine expand: called CC=6 SCAR=18.1
Pod undocumented
19 4 my $contents = shift;
20 4 my $callback = shift;
21 4 my $c = 0;
22  
23 4 ▶ my $iter = Archive::Tar->iter(IO::Scalar->new(
Branch: 1 branch
BranchTrueFalseTotal
ref $contents eq 'SCALAR' ? : 4 0 4
24 ref $contents eq 'SCALAR' ? $contents : \$contents
25 ));
26 4 ▶ while( my $f = $iter->() ){
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = &$iter()) 12 4 16
27 12 ▶ if( $f->has_content and $f->validate ){
Branch: 1 branch
BranchTrueFalseTotal
if ($f->has_content and $f->validate) 8 4 12
Condition66%2/3
$f->has_content and $f->validate
!ll&&!rl&&r
408
MC/DC50%1/2
$f->has_content and $f->validate
$f->has_content $f->validate
Truth table66%2/3
A and B
A= $f->has_contentB= $f->validate
ABresult
0X0
100
111
28 8 ▶ $callback->( $f->get_content_by_ref, {
Branch: 1 branch
BranchTrueFalseTotal
if ref $callback eq "CODE" 8 0 8
29 filename => $f->full_path,
30 } ) if( ref $callback eq 'CODE' );
31 8 ++$c;
32 }
33 }
34  
35 4 return $c;
36 }
37  
38 4 1;
39 __END__
« Expander/Plugin/ApplicationGzip.pm ↑ Summary Expander/Guess/FileName.pm »