Expander/Plugin/MessageRFC822.pm

filter: Statementstmt 100% 29 / 29 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 93.1% 41 / 44 CC 5 SCAR 11.0
CC
5
Cov
95%
expand
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Expander/Guess/FileName.pm ↑ Summary Expander/Plugin.pm »
1 package MIME::Expander::Plugin::MessageRFC822;
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 message/rfc822
11 )]);
12  
13 4 ▶use Email::MIME;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub expand {
16 4 ▶ my $self = shift;
Subroutine expand: called CC=5 SCAR=16.2
Pod undocumented
17 4 my $contents = shift;
18 4 my $callback = shift;
19 4 my $c = 0;
20  
21 4 ▶ my @parts = (Email::MIME->new(
Branch: 1 branch
BranchTrueFalseTotal
ref $contents eq 'SCALAR' ? : 4 0 4
22 ref $contents eq 'SCALAR' ? $contents : \$contents
23 ));
24 4 ▶ while( my $part = shift @parts ){
Branch: 1 branch
BranchTrueFalseTotal
if (my $part = shift @parts) 18 4 22
25 18 ▶ if( 1 < $part->parts ){
Branch: 1 branch
BranchTrueFalseTotal
if (1 < $part->parts) { } 4 14 18
26 4 push @parts, $part->subparts;
27 }else{
28 14 ++$c;
29 14 ▶ $callback->( \$part->body, {
Branch: 1 branch
BranchTrueFalseTotal
if ref $callback eq "CODE" 14 0 14
30 filename => $part->filename,
31 } ) if( ref $callback eq 'CODE' );
32 }
33 }
34  
35 4 return $c;
36 }
37  
38 4 1;
39 __END__
« Expander/Guess/FileName.pm ↑ Summary Expander/Plugin.pm »