Expander/Plugin/ApplicationTar.pm

filter: Statementstmt 100% 32 / 32 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 92.1% 47 / 51 CC 5 SCAR 10.4
CC
5
Cov
95%
expand
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Expander/Guess/FileName.pm ↑ Summary Expander/Plugin/MessageRFC822.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.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/tar
11 )]);
12  
13 4 ▶use Archive::Tar;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use IO::Scalar;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 5 ▶sub expand {
Subroutine expand: called CC=5 SCAR=16.1
Pod undocumented
17 5 my $self = shift;
18 5 my $part = shift;
19 5 my $callback = shift;
20 5 my $c = 0;
21  
22 5 my $contents = $part->body;
23 5 my $iter = Archive::Tar->iter(IO::Scalar->new(
24 \$contents,
25 ));
26 5 ▶ while( my $f = $iter->() ){
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = &$iter()) 15 5 20
27 15 ▶ if( $f->has_content and $f->validate ){
Branch: 1 branch
BranchTrueFalseTotal
if ($f->has_content and $f->validate) 10 5 15
Condition66%2/3
$f->has_content and $f->validate
!ll&&!rl&&r
5010
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 10 ▶ $callback->( $f->get_content_by_ref, {
Branch: 1 branch
BranchTrueFalseTotal
if ref $callback eq "CODE" 10 0 10
29 filename => $f->full_path,
30 } ) if( ref $callback eq 'CODE' );
31 10 ++$c;
32 }
33 }
34  
35 5 return $c;
36 }
37  
38 4 1;
39 __END__
« Expander/Guess/FileName.pm ↑ Summary Expander/Plugin/MessageRFC822.pm »