blib/lib/Egg/View/Mail/MIME/Entity.pm

filter: Statementstmt 39.2% 11 / 28 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 33.3% 15 / 45 CC 9 SCAR 42.2
CC
9
Cov
28%
create_mail_body
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 67.8
↑ Summary blib/lib/Egg/View/Mail/Mailer/SMTP.pm »
1 package Egg::View::Mail::MIME::Entity;
2 #
3 # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4 #
5 # $Id: Entity.pm 285 2008-02-28 04:20:55Z lushe $
6 #
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use MIME::Entity;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our $VERSION = '0.01';
12  
13 0 ▶sub create_mail_body {
Subroutine create_mail_body: not called CC=9 SCAR=45.0
Pod documented
14 0 my($self, $data)= @_;
15 0 my $mime= do {
16 0 my %attr;
17 0 my $body= $self->__get_mailbody($data);
18 0 ▶ if (my $headers= $data->{headers}) { %attr= %$headers }
Branch: 1 branch
BranchTrueFalseTotal
if (my $headers = $data->{"headers"}) 0 0 0
19 0 for ( [qw/ to To /],
20 [qw/ from From /],
21 [qw/ cc CC /],
22 [qw/ bcc BCC /],
23 [qw/ replay_to Reply-To /],
24 [qw/ return_path Return-Path /],
25 [qw/ subject Subject /],
26 [qw/ x_mailer X-Mailer /] ) {
27 0 ▶ $attr{$_->[1]}= $data->{$_->[0]} if $data->{$_->[0]};
Branch: 1 branch
BranchTrueFalseTotal
if $$data{$_->[0]} 0 0 0
28 }
29 0 MIME::Entity->build( %attr, Data=> [$$body] );
30 };
31 0 ▶ if (my $attach= $data->{attach}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $attach = $data->{"attach"}) 0 0 0
32 0 eval{
33 0 ▶ if (ref($attach) eq 'HASH') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $attach eq 'HASH') { } 0 0 0
elsif (ref $attach eq 'ARRAY') { } 0 0 0
34 0 $mime->attach(%$attach);
35 } elsif (ref($attach) eq 'ARRAY') {
36 0 $mime->attach(%$_) for @{$self->attach};
37 }
38 };
39 0 ▶ $@ and die $@;
Branch: 1 branch
BranchTrueFalseTotal
$@ and die $@ 0 0 0
40 }
41 0 \$mime->stringify;
42 }
43  
44 2 1;
45  
46 __END__
↑ Summary blib/lib/Egg/View/Mail/Mailer/SMTP.pm »