| 1 | # Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.03. | ||||||||||||||||||||||||||||||||
| 5 | # This code is part of distribution Mail-Message. Meta-POD processed with | ||||||||||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | package Mail::Message; | ||||||||||||||||||||||||||||||||
| 10 | 31 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 31 | $VERSION = '3.012'; | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 31 | ▶ | use base 'Mail::Reporter'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 31 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 31 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 31 | ▶ | use Mail::Message::Part (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | 31 | ▶ | use Mail::Message::Head::Complete (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 20 | 31 | ▶ | use Mail::Message::Construct (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 31 | ▶ | use Mail::Message::Body::Lines (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | 31 | ▶ | use Mail::Message::Body::Multipart (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 24 | 31 | ▶ | use Mail::Message::Body::Nested (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 31 | ▶ | use Carp; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 27 | 31 | ▶ | use Scalar::Util qw(weaken blessed); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | BEGIN { | ||||||||||||||||||||||||||||||||
| 30 | 31 | ▶ | unless($ENV{HARNESS_ACTIVE}) { # no tests during upgrade | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=4 SCAR=25.5
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 31 | # v3 splits Mail::Box in a few distributions | ||||||||||||||||||||||||||||||||
| 32 | 0 | eval { require Mail::Box }; | |||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $v = $Mail::Box::VERSION || 3; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$Mail::Box::VERSION || 3
MC/DC0%0/1
$Mail::Box::VERSION || 3
$Mail::Box::VERSION
Truth table0%0/2
A
A= $Mail::Box::VERSION
| |||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $v >= 3 or die "You need to upgrade the Mail::Box module"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | 31 | our $crlf_platform = $^O =~ m/win32/i; | |||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | sub init($) | ||||||||||||||||||||||||||||||||
| 45 | 109 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=13 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 46 | 109 | $self->SUPER::init($args); | |||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | # Field initializations also in coerce() | ||||||||||||||||||||||||||||||||
| 49 | 109 | ▶ | $self->{MM_modified} = $args->{modified} || 0; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'modified'} || 0
MC/DC0%0/1
$args->{'modified'} || 0
$args->{'modified'}
Truth table50%1/2
A
A= $args->{'modified'}
| |||||||||||||||||||||||||||||||||
| 50 | 109 | ▶ | $self->{MM_trusted} = $args->{trusted} || 0; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'trusted'} || 0
MC/DC0%0/1
$args->{'trusted'} || 0
$args->{'trusted'}
Truth table50%1/2
A
A= $args->{'trusted'}
| |||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | # Set the header | ||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 109 | my $head; | |||||||||||||||||||||||||||||||
| 55 | 109 | ▶ | if(defined($head = $args->{head})) { $self->head($head) } | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 56 | ▶ | elsif(my $msgid = $args->{messageId} || $args->{messageID}) | |||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'messageId'} || $args->{'messageID'}
MC/DC0%0/2
$args->{'messageId'} || $args->{'messageID'}
$args->{'messageId'}
$args->{'messageID'}
Truth table33%1/3
A || B
A= $args->{'messageId'}B= $args->{'messageID'}
| |||||||||||||||||||||||||||||||||
| 57 | 0 | { $self->takeMessageId($msgid); | |||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | # Set the body | ||||||||||||||||||||||||||||||||
| 61 | 109 | ▶ | if(my $body = $args->{body}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | 11 | { $self->{MM_body} = $body; | |||||||||||||||||||||||||||||||
| 63 | 11 | $body->message($self); | |||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | $self->{MM_body_type} = $args->{body_type} | ||||||||||||||||||||||||||||||||
| 67 | 109 | ▶ | if defined $args->{body_type}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | $self->{MM_head_type} = $args->{head_type} | ||||||||||||||||||||||||||||||||
| 70 | 109 | ▶ | if defined $args->{head_type}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | $self->{MM_field_type} = $args->{field_type} | ||||||||||||||||||||||||||||||||
| 73 | 109 | ▶ | if defined $args->{field_type}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | 109 | ▶ | my $labels = $args->{labels} || []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'labels'} || []
MC/DC0%0/1
$args->{'labels'} || []
$args->{'labels'}
Truth table50%1/2
A
A= $args->{'labels'}
| |||||||||||||||||||||||||||||||||
| 76 | 109 | ▶ | my @labels = ref $labels eq 'ARRAY' ? @$labels : %$labels; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 77 | 109 | ▶ | push @labels, deleted => $args->{deleted} if exists $args->{deleted}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 78 | 109 | $self->{MM_labels} = { @labels }; | |||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | 109 | $self; | |||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | sub clone(@) | ||||||||||||||||||||||||||||||||
| 85 | 10 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=5 SCAR=17.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | # First clone body, which may trigger head load as well. If head is | ||||||||||||||||||||||||||||||||
| 88 | # triggered first, then it may be decided to be lazy on the body at | ||||||||||||||||||||||||||||||||
| 89 | # moment. And then the body would be triggered. | ||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | 10 | my ($head, $body) = ($self->head, $self->body); | |||||||||||||||||||||||||||||||
| 92 | $head = $head->clone | ||||||||||||||||||||||||||||||||
| 93 | 10 | ▶ | unless $args{shallow} || $args{shallow_head}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"shallow"} or $args{"shallow_head"}
MC/DC0%0/2
$args{"shallow"} or $args{"shallow_head"}
$args{"shallow"}
$args{"shallow_head"}
Truth table33%1/3
A or B
A= $args{"shallow"}B= $args{"shallow_head"}
| |||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | $body = $body->clone | ||||||||||||||||||||||||||||||||
| 96 | 10 | ▶ | unless $args{shallow} || $args{shallow_body}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"shallow"} or $args{"shallow_body"}
MC/DC0%0/2
$args{"shallow"} or $args{"shallow_body"}
$args{"shallow"}
$args{"shallow_body"}
Truth table33%1/3
A or B
A= $args{"shallow"}B= $args{"shallow_body"}
| |||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | 10 | my $clone = Mail::Message->new | |||||||||||||||||||||||||||||||
| 99 | ( head => $head | ||||||||||||||||||||||||||||||||
| 100 | , body => $body | ||||||||||||||||||||||||||||||||
| 101 | , $self->logSettings | ||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||
| 104 | 10 | my $labels = $self->labels; | |||||||||||||||||||||||||||||||
| 105 | 10 | my %labels = %$labels; | |||||||||||||||||||||||||||||||
| 106 | 10 | delete $labels{deleted}; | |||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | 10 | $clone->{MM_labels} = \%labels; | |||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | 10 | $clone->{MM_cloned} = $self; | |||||||||||||||||||||||||||||||
| 111 | 10 | weaken($clone->{MM_cloned}); | |||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 10 | $clone; | |||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||
| 119 | 39 | ▶ | sub messageId() { $_[0]->{MM_message_id} || $_[0]->takeMessageId} | ||||||||||||||||||||||||||||||
|
Subroutine
messageId: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub messageID() {shift->messageId} # compatibility | ||||||||||||||||||||||||||||||
|
Subroutine
messageID: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||
| 123 | sub container() { undef } # overridden by Mail::Message::Part | ||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||
| 126 | sub isPart() { 0 } # overridden by Mail::Message::Part | ||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||
| 129 | sub partNumber() | ||||||||||||||||||||||||||||||||
| 130 | 2 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
partNumber: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 131 | 2 | my $cont = $self->container; | |||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | $cont ? $cont->partNumber : undef; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||
| 136 | 10 | ▶ | sub toplevel() { shift } # overridden by Mail::Message::Part | ||||||||||||||||||||||||||||||
|
Subroutine
toplevel: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||
| 139 | sub isDummy() { 0 } | ||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||
| 142 | sub print(;$) | ||||||||||||||||||||||||||||||||
| 143 | 31 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
print: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 144 | 31 | ▶ | my $out = shift || select; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
shift() || select()
MC/DC0%0/2
shift() || select()
shift()
select()
Truth table33%1/3
A || B
A= shift()B= select()
| |||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||
| 146 | 31 | $self->head->print($out); | |||||||||||||||||||||||||||||||
| 147 | 31 | my $body = $self->body; | |||||||||||||||||||||||||||||||
| 148 | 31 | ▶ | $body->print($out) if $body; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 149 | 31 | $self; | |||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||
| 153 | sub write(;$) | ||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | my $out = shift || select; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || select()
MC/DC0%0/2
shift() || select()
shift()
select()
Truth table0%0/3
A || B
A= shift()B= select()
| |||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||
| 157 | 0 | $self->head->print($out); | |||||||||||||||||||||||||||||||
| 158 | 0 | $self->body->print($out); | |||||||||||||||||||||||||||||||
| 159 | 0 | $self; | |||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||
| 163 | 31 | my $default_mailer; | |||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||
| 165 | sub send(@) | ||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
send: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||
| 168 | # Loosely coupled module | ||||||||||||||||||||||||||||||||
| 169 | 0 | require Mail::Transport::Send; | |||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||
| 171 | 0 | my $mailer; | |||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $default_mailer = $mailer = shift | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $_[0] and $_[0]->isa("Mail::Transport::Send")
MC/DC0%0/2
ref $_[0] and $_[0]->isa("Mail::Transport::Send")
ref $_[0]
$_[0]->isa("Mail::Transport::Send")
Truth table0%0/3
A and B
A= ref $_[0]B= $_[0]->isa("Mail::Transport::Send")
| |||||||||||||||||||||||||||||||||
| 173 | if ref $_[0] && $_[0]->isa('Mail::Transport::Send'); | ||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||
| 175 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if( ! $args{via} && defined $default_mailer ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $args{"via"} and defined $default_mailer
MC/DC0%0/2
not $args{"via"} and defined $default_mailer
not $args{"via"}
defined $default_mailer
Truth table0%0/3
not(A) and B
A= not $args{"via"}B= defined $default_mailer
| |||||||||||||||||||||||||||||||||
| 177 | 0 | { $mailer = $default_mailer; | |||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||
| 179 | else | ||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | { my $via = delete $args{via} || 'sendmail'; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $args{'via'} || 'sendmail'
MC/DC0%0/1
delete $args{'via'} || 'sendmail'
delete $args{'via'}
Truth table0%0/2
A
A= delete $args{'via'}
| |||||||||||||||||||||||||||||||||
| 181 | 0 | $default_mailer = $mailer = Mail::Transport->new(via => $via, %args); | |||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||
| 184 | 0 | $mailer->send($self, %args); | |||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||
| 188 | sub size() | ||||||||||||||||||||||||||||||||
| 189 | 57 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 190 | 57 | $self->head->size + $self->body->size; | |||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||
| 193 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||
| 196 | sub head(;$) | ||||||||||||||||||||||||||||||||
| 197 | 952 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
head: called CC=8 SCAR=24.7
Pod
documented
| |||||||||||||||||||||||||||||||||
| 198 | 952 | ▶ | return $self->{MM_head} unless @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||
| 200 | 114 | my $head = shift; | |||||||||||||||||||||||||||||||
| 201 | 114 | ▶ | unless(defined $head) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 202 | 0 | { delete $self->{MM_head}; | |||||||||||||||||||||||||||||||
| 203 | 0 | return undef; | |||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||
| 206 | 114 | ▶ | $self->log(INTERNAL => "wrong type of head ($head) for message $self") | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $head and $head->isa("Mail::Message::Head")
MC/DC0%0/2
ref $head and $head->isa("Mail::Message::Head")
ref $head
$head->isa("Mail::Message::Head")
Truth table33%1/3
A and B
A= ref $headB= $head->isa("Mail::Message::Head")
| |||||||||||||||||||||||||||||||||
| 207 | unless ref $head && $head->isa('Mail::Message::Head'); | ||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||
| 209 | 114 | $head->message($self); | |||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | 114 | ▶ | if(my $old = $self->{MM_head}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | { $self->{MM_modified}++ unless $old->isDelayed; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | 114 | $self->{MM_head} = $head; | |||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||
| 217 | 114 | ▶ | $self->takeMessageId unless $head->isDelayed; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | 114 | $head; | |||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | sub get($) | ||||||||||||||||||||||||||||||||
| 224 | 164 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 225 | 164 | ▶ | my $field = $self->head->get(shift) || return undef; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->head->get(shift()) || (return undef)
MC/DC100%1/1
$self->head->get(shift()) || (return undef)
$self->head->get(shift())
Truth table100%2/2
A
A= $self->head->get(shift())
| |||||||||||||||||||||||||||||||||
| 226 | 68 | $field->body; | |||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||
| 230 | sub study($) | ||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | { my $head = shift->head or return; | ||||||||||||||||||||||||||||||
|
Subroutine
study: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 232 | 0 | scalar $head->study(@_); # return only last | |||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||
| 236 | sub from() | ||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | { my @from = shift->head->get('From') or return (); | ||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 238 | 0 | map $_->addresses, @from; | |||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||
| 242 | sub sender() | ||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
sender: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | my $sender = $self->head->get('Sender') || $self->head->get('From') | ||||||||||||||||||||||||||||||
|
Condition0%0/5
$self->head->get('Sender') || $self->head->get('From') || (return ())
$self->head->get("Sender") or $self->head->get("From")
MC/DC0%0/2
$self->head->get('Sender') || $self->head->get('From') || (return ())
$self->head->get("Sender")
$self->head->get("From")
Truth table0%0/3
A or B
A= $self->head->get("Sender")B= $self->head->get("From")
| |||||||||||||||||||||||||||||||||
| 245 | || return (); | ||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||
| 247 | 0 | ($sender->addresses)[0]; # first specified address | |||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||
| 251 | 10 | ▶ | sub to() { map $_->addresses, shift->head->get('To') } | ||||||||||||||||||||||||||||||
|
Subroutine
to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||
| 254 | 2 | ▶ | sub cc() { map $_->addresses, shift->head->get('Cc') } | ||||||||||||||||||||||||||||||
|
Subroutine
cc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub bcc() { map $_->addresses, shift->head->get('Bcc') } | ||||||||||||||||||||||||||||||
|
Subroutine
bcc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||
| 260 | sub destinations() | ||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
destinations: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 262 | 0 | my %to = map +(lc($_->address) => $_), $self->to, $self->cc, $self->bcc; | |||||||||||||||||||||||||||||||
| 263 | 0 | values %to; | |||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||
| 267 | sub subject() | ||||||||||||||||||||||||||||||||
| 268 | 16 | ▶ | { my $subject = shift->get('subject'); | ||||||||||||||||||||||||||||||
|
Subroutine
subject: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 269 | 16 | ▶ | defined $subject ? $subject : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub guessTimestamp() {shift->head->guessTimestamp} | ||||||||||||||||||||||||||||||
|
Subroutine
guessTimestamp: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||
| 276 | sub timestamp() | ||||||||||||||||||||||||||||||||
| 277 | 2 | ▶ | { my $head = shift->head; | ||||||||||||||||||||||||||||||
|
Subroutine
timestamp: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 278 | 2 | ▶ | $head->recvstamp || $head->timestamp; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||
| 282 | sub nrLines() | ||||||||||||||||||||||||||||||||
| 283 | 41 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
nrLines: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 284 | 41 | $self->head->nrLines + $self->body->nrLines; | |||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||
| 287 | #------------------------------------------- | ||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||
| 290 | sub body(;$@) | ||||||||||||||||||||||||||||||||
| 291 | 529 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
body: called CC=11 SCAR=28.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 292 | 529 | ▶ | return $self->{MM_body} unless @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||
| 294 | 86 | my $head = $self->head; | |||||||||||||||||||||||||||||||
| 295 | 86 | ▶ | $head->removeContentInfo if defined $head; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||
| 297 | 86 | my ($rawbody, %args) = @_; | |||||||||||||||||||||||||||||||
| 298 | 86 | ▶ | unless(defined $rawbody) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 299 | { # Disconnect body from message. | ||||||||||||||||||||||||||||||||
| 300 | 0 | my $body = delete $self->{MM_body}; | |||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | $body->message(undef) if defined $body; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 302 | 0 | return $body; | |||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||
| 305 | 86 | ▶ | ref $rawbody && $rawbody->isa('Mail::Message::Body') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $rawbody and $rawbody->isa("Mail::Message::Body")
MC/DC0%0/2
ref $rawbody and $rawbody->isa("Mail::Message::Body")
ref $rawbody
$rawbody->isa("Mail::Message::Body")
Truth table33%1/3
A and B
A= ref $rawbodyB= $rawbody->isa("Mail::Message::Body")
| |||||||||||||||||||||||||||||||||
| 306 | or $self->log(INTERNAL => "wrong type of body for message $rawbody"); | ||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||
| 308 | # Bodies of real messages must be encoded for safe transmission. | ||||||||||||||||||||||||||||||||
| 309 | # Message parts will get encoded on the moment the whole multipart | ||||||||||||||||||||||||||||||||
| 310 | # is transformed into a real message. | ||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||
| 312 | 86 | ▶ | my $body = $self->isPart ? $rawbody : $rawbody->encoded; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 313 | 86 | $body->contentInfoTo($self->head); | |||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||
| 315 | 86 | my $oldbody = $self->{MM_body}; | |||||||||||||||||||||||||||||||
| 316 | 86 | ▶ | return $body if defined $oldbody && $body==$oldbody; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $oldbody and $body == $oldbody
MC/DC0%0/2
defined $oldbody and $body == $oldbody
defined $oldbody
$body == $oldbody
Truth table33%1/3
A and B
A= defined $oldbodyB= $body == $oldbody
| |||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||
| 318 | 86 | $body->message($self); | |||||||||||||||||||||||||||||||
| 319 | 86 | ▶ | $body->modified(1) if defined $oldbody; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||
| 321 | 86 | $self->{MM_body} = $body; | |||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||
| 325 | sub decoded(@) | ||||||||||||||||||||||||||||||||
| 326 | 2 | ▶ | { my $body = shift->body->load; | ||||||||||||||||||||||||||||||
|
Subroutine
decoded: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 327 | 2 | ▶ | $body ? $body->decoded(@_) : undef; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||
| 331 | sub encode(@) | ||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | { my $body = shift->body->load; | ||||||||||||||||||||||||||||||
|
Subroutine
encode: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $body ? $body->encode(@_) : undef; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||
| 337 | 131 | ▶ | sub isMultipart() {shift->head->isMultipart} | ||||||||||||||||||||||||||||||
|
Subroutine
isMultipart: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||
| 340 | 60 | ▶ | sub isNested() {shift->body->isNested} | ||||||||||||||||||||||||||||||
|
Subroutine
isNested: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||
| 343 | sub contentType() | ||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | { my $head = shift->head; | ||||||||||||||||||||||||||||||
|
Subroutine
contentType: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | my $ct = (defined $head ? $head->get('Content-Type', 0) : undef) || ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
(defined $head ? $head->get('Content-Type', 0) : undef) || ''
MC/DC0%0/1
(defined $head ? $head->get('Content-Type', 0) : undef) || ''
(defined $head ? $head->get('Content-Type', 0) : undef)
Truth table0%0/2
A
A= (defined $head ? $head->get('Content-Type', 0) : undef)
| |||||||||||||||||||||||||||||||||
| 346 | 0 | $ct =~ s/\s*\;.*//; | |||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | length $ct ? $ct : 'text/plain'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | sub parts(;$) | ||||||||||||||||||||||||||||||||
| 352 | 23 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
parts: called CC=11 SCAR=32.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 353 | 23 | ▶ | my $what = shift || 'ACTIVE'; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 'ACTIVE'
MC/DC100%1/1
shift() || 'ACTIVE'
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||
| 355 | 23 | my $body = $self->body; | |||||||||||||||||||||||||||||||
| 356 | 23 | ▶ | my $recurse = $what eq 'RECURSE' || ref $what; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$what eq 'RECURSE' || ref $what
MC/DC0%0/2
$what eq 'RECURSE' || ref $what
$what eq 'RECURSE'
ref $what
Truth table33%1/3
A || B
A= $what eq 'RECURSE'B= ref $what
| |||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||
| 358 | my @parts | ||||||||||||||||||||||||||||||||
| 359 | 23 | ▶ | = $body->isNested ? $body->nested->parts($what) | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 360 | : $body->isMultipart ? $body->parts($recurse ? 'RECURSE' : ()) | ||||||||||||||||||||||||||||||||
| 361 | : $self; | ||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||
| 363 | 23 | ▶ | ref $what eq 'CODE' ? (grep $what->($_), @parts) | ||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||
| 364 | : $what eq 'ACTIVE' ? (grep !$_->isDeleted, @parts) | ||||||||||||||||||||||||||||||||
| 365 | : $what eq 'DELETED' ? (grep $_->isDeleted, @parts) | ||||||||||||||||||||||||||||||||
| 366 | : $what eq 'ALL' ? @parts | ||||||||||||||||||||||||||||||||
| 367 | : $recurse ? @parts | ||||||||||||||||||||||||||||||||
| 368 | : confess "Select parts via $what?"; | ||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||
| 371 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||
| 374 | sub modified(;$) | ||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
modified: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | return $self->isModified unless @_; # compatibility 2.036 | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||
| 379 | 0 | my $flag = shift; | |||||||||||||||||||||||||||||||
| 380 | 0 | $self->{MM_modified} = $flag; | |||||||||||||||||||||||||||||||
| 381 | 0 | my $head = $self->head; | |||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | $head->modified($flag) if $head; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 383 | 0 | my $body = $self->body; | |||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | $body->modified($flag) if $body; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||
| 386 | 0 | $flag; | |||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||
| 390 | sub isModified() | ||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
isModified: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | return 1 if $self->{MM_modified}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||
| 394 | 0 | my $head = $self->head; | |||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if($head && $head->isModified) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$head and $head->isModified
MC/DC0%0/2
$head and $head->isModified
$head
$head->isModified
Truth table0%0/3
A and B
A= $headB= $head->isModified
| |||||||||||||||||||||||||||||||||
| 396 | 0 | { $self->{MM_modified}++; | |||||||||||||||||||||||||||||||
| 397 | 0 | return 1; | |||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||
| 400 | 0 | my $body = $self->body; | |||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if($body && $body->isModified) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$body and $body->isModified
MC/DC0%0/2
$body and $body->isModified
$body
$body->isModified
Truth table0%0/3
A and B
A= $bodyB= $body->isModified
| |||||||||||||||||||||||||||||||||
| 402 | 0 | { $self->{MM_modified}++; | |||||||||||||||||||||||||||||||
| 403 | 0 | return 1; | |||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||
| 406 | 0 | 0; | |||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||
| 410 | sub label($;$@) | ||||||||||||||||||||||||||||||||
| 411 | 267 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
label: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 412 | 267 | ▶ | return $self->{MM_labels}{$_[0]} unless @_ > 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 413 | 17 | my $return = $_[1]; | |||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||
| 415 | 17 | my %labels = @_; | |||||||||||||||||||||||||||||||
| 416 | 17 | @{$self->{MM_labels}}{keys %labels} = values %labels; | |||||||||||||||||||||||||||||||
| 417 | 17 | $return; | |||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||
| 421 | sub labels() | ||||||||||||||||||||||||||||||||
| 422 | 10 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
labels: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 423 | 10 | ▶ | wantarray ? keys %{$self->{MM_labels}} : $self->{MM_labels}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||
| 427 | 240 | ▶ | sub isDeleted() { shift->label('deleted') } | ||||||||||||||||||||||||||||||
|
Subroutine
isDeleted: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||
| 430 | sub delete() | ||||||||||||||||||||||||||||||||
| 431 | 4 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
delete: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 432 | 4 | my $old = $self->label('deleted'); | |||||||||||||||||||||||||||||||
| 433 | 4 | ▶ | $old || $self->label(deleted => time); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||
| 437 | sub deleted(;$) | ||||||||||||||||||||||||||||||||
| 438 | 2 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
deleted: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||
| 440 | 2 | ▶ | @_ ? $self->label(deleted => shift) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 441 | : $self->label('deleted') # compat 2.036 | ||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||
| 445 | sub labelsToStatus() | ||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
labelsToStatus: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 447 | 0 | my $head = $self->head; | |||||||||||||||||||||||||||||||
| 448 | 0 | my $labels = $self->labels; | |||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | my $status = $head->get('status') || ''; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$head->get('status') || ''
MC/DC0%0/1
$head->get('status') || ''
$head->get('status')
Truth table0%0/2
A
A= $head->get('status')
| |||||||||||||||||||||||||||||||||
| 451 | my $newstatus | ||||||||||||||||||||||||||||||||
| 452 | = $labels->{seen} ? 'RO' | ||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | : $labels->{old} ? 'O' | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 454 | : ''; | ||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | $head->set(Status => $newstatus) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 457 | if $newstatus ne $status; | ||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | my $xstatus = $head->get('x-status') || ''; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$head->get('x-status') || ''
MC/DC0%0/1
$head->get('x-status') || ''
$head->get('x-status')
Truth table0%0/2
A
A= $head->get('x-status')
| |||||||||||||||||||||||||||||||||
| 460 | my $newxstatus | ||||||||||||||||||||||||||||||||
| 461 | = ($labels->{replied} ? 'A' : '') | ||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | . ($labels->{flagged} ? 'F' : ''); | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | $head->set('X-Status' => $newxstatus) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 465 | if $newxstatus ne $xstatus; | ||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||
| 467 | 0 | $self; | |||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||
| 471 | sub statusToLabels() | ||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
statusToLabels: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 473 | 0 | my $head = $self->head; | |||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | if(my $status = $head->get('status')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 476 | 0 | { $status = $status->foldedBody; | |||||||||||||||||||||||||||||||
| 477 | 0 | $self->label | |||||||||||||||||||||||||||||||
| 478 | ( seen => (index($status, 'R') >= 0) | ||||||||||||||||||||||||||||||||
| 479 | , old => (index($status, 'O') >= 0) | ||||||||||||||||||||||||||||||||
| 480 | ); | ||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | if(my $xstatus = $head->get('x-status')) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 484 | 0 | { $xstatus = $xstatus->foldedBody; | |||||||||||||||||||||||||||||||
| 485 | 0 | $self->label | |||||||||||||||||||||||||||||||
| 486 | ( replied => (index($xstatus, 'A') >= 0) | ||||||||||||||||||||||||||||||||
| 487 | , flagged => (index($xstatus, 'F') >= 0) | ||||||||||||||||||||||||||||||||
| 488 | ); | ||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||
| 491 | 0 | $self; | |||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||
| 494 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||
| 497 | my $mail_internet_converter; | ||||||||||||||||||||||||||||||||
| 498 | 31 | my $mime_entity_converter; | |||||||||||||||||||||||||||||||
| 499 | 31 | my $email_simple_converter; | |||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||
| 501 | sub coerce($@) | ||||||||||||||||||||||||||||||||
| 502 | 10 | ▶ | { my ($class, $message) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
coerce: called CC=18 SCAR=53.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||
| 504 | 10 | ▶ | blessed $message | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 505 | or die "coercion starts with some object"; | ||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||
| 507 | 10 | ▶ | return $message | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 508 | if ref $message eq $class; | ||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||
| 510 | 10 | ▶ | if($message->isa(__PACKAGE__)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 511 | 10 | $message->head->modified(1); | |||||||||||||||||||||||||||||||
| 512 | 10 | $message->body->modified(1); | |||||||||||||||||||||||||||||||
| 513 | 10 | return bless $message, $class; | |||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | if($message->isa('MIME::Entity')) | ||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | { unless($mime_entity_converter) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 518 | 0 | { eval {require Mail::Message::Convert::MimeEntity}; | |||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | confess "Install MIME::Entity" if $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 520 | 0 | $mime_entity_converter = Mail::Message::Convert::MimeEntity->new; | |||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | $message = $mime_entity_converter->from($message) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 524 | or return; | ||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||
| 527 | elsif($message->isa('Mail::Internet')) | ||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | { unless($mail_internet_converter) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 529 | 0 | { eval {require Mail::Message::Convert::MailInternet}; | |||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | confess "Install Mail::Internet" if $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 531 | 0 | $mail_internet_converter = Mail::Message::Convert::MailInternet->new; | |||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | $message = $mail_internet_converter->from($message) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 535 | or return; | ||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||
| 538 | elsif($message->isa('Email::Simple')) | ||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | { unless($email_simple_converter) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 540 | 0 | { eval {require Mail::Message::Convert::EmailSimple}; | |||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | confess "Install Email::Simple" if $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 542 | 0 | $email_simple_converter = Mail::Message::Convert::EmailSimple->new; | |||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | $message = $email_simple_converter->from($message) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 546 | or return; | ||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||
| 549 | elsif($message->isa('Email::Abstract')) | ||||||||||||||||||||||||||||||||
| 550 | 0 | { return $class->coerce($message->object); | |||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||
| 553 | else | ||||||||||||||||||||||||||||||||
| 554 | 0 | { $class->log(INTERNAL => "Cannot coerce a ". ref($message) | |||||||||||||||||||||||||||||||
| 555 | . " object into a ". __PACKAGE__." object"); | ||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | $message->{MM_modified} ||= 0; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$message->{"MM_modified"} ||= 0
MC/DC0%0/1
$message->{"MM_modified"} ||= 0
$message->{"MM_modified"}
Truth table0%0/2
A
A= $message->{"MM_modified"}
| |||||||||||||||||||||||||||||||||
| 559 | 0 | bless $message, $class; | |||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | sub clonedFrom() { shift->{MM_cloned} } | ||||||||||||||||||||||||||||||
|
Subroutine
clonedFrom: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||
| 565 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 566 | # All next routines try to create compatibility with release < 2.0 | ||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | sub isParsed() { not shift->isDelayed } | ||||||||||||||||||||||||||||||
|
Subroutine
isParsed: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | sub headIsRead() { not shift->head->isDelayed } | ||||||||||||||||||||||||||||||
|
Subroutine
headIsRead: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||
| 571 | sub readFromParser($;$) | ||||||||||||||||||||||||||||||||
| 572 | 7 | ▶ | { my ($self, $parser, $bodytype) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
readFromParser: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||
| 574 | my $head = $self->readHead($parser) | ||||||||||||||||||||||||||||||||
| 575 | || Mail::Message::Head::Complete->new | ||||||||||||||||||||||||||||||||
| 576 | ( message => $self | ||||||||||||||||||||||||||||||||
| 577 | , field_type => $self->{MM_field_type} | ||||||||||||||||||||||||||||||||
| 578 | 7 | ▶ | , $self->logSettings | ||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->readHead($parser) || 'Mail::Message::Head::Complete'->new('message', $self, 'field_type', $self->{'MM_field_type'}, $self->logSettings)
MC/DC0%0/2
$self->readHead($parser) || 'Mail::Message::Head::Complete'->new('message', $self, 'field_type', $self->{'MM_field_type'}, $self->logSettings)
$self->readHead($parser)
'Mail::Message::Head::Complete'->new('message', $self, 'field_type', $self->{'MM_field_type'}, $self->logSettings)
Truth table33%1/3
A || B
A= $self->readHead($parser)B= 'Mail::Message::Head::Complete'->new('message', $self, 'field_type', $self->{'MM_field_type'}, $self->logSettings)
| |||||||||||||||||||||||||||||||||
| 579 | ); | ||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||
| 581 | 7 | ▶ | my $body = $self->readBody($parser, $head, $bodytype) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 582 | or return; | ||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||
| 584 | 7 | $self->head($head); | |||||||||||||||||||||||||||||||
| 585 | 7 | $self->storeBody($body); | |||||||||||||||||||||||||||||||
| 586 | 7 | $self; | |||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||
| 590 | sub readHead($;$) | ||||||||||||||||||||||||||||||||
| 591 | 12 | ▶ | { my ($self, $parser) = (shift, shift); | ||||||||||||||||||||||||||||||
|
Subroutine
readHead: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||
| 593 | my $headtype = shift | ||||||||||||||||||||||||||||||||
| 594 | 12 | ▶ | || $self->{MM_head_type} || 'Mail::Message::Head::Complete'; | ||||||||||||||||||||||||||||||
|
Condition40%2/5
shift() || $self->{'MM_head_type'} || 'Mail::Message::Head::Complete'
shift() or $self->{"MM_head_type"}
MC/DC0%0/2
shift() || $self->{'MM_head_type'} || 'Mail::Message::Head::Complete'
shift()
$self->{"MM_head_type"}
Truth table33%1/3
A or B
A= shift()B= $self->{"MM_head_type"}
| |||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||
| 596 | $headtype->new | ||||||||||||||||||||||||||||||||
| 597 | ( message => $self | ||||||||||||||||||||||||||||||||
| 598 | , field_type => $self->{MM_field_type} | ||||||||||||||||||||||||||||||||
| 599 | 12 | , $self->logSettings | |||||||||||||||||||||||||||||||
| 600 | )->read($parser); | ||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||
| 604 | 31 | my $mpbody = 'Mail::Message::Body::Multipart'; | |||||||||||||||||||||||||||||||
| 605 | 31 | my $nbody = 'Mail::Message::Body::Nested'; | |||||||||||||||||||||||||||||||
| 606 | 31 | my $lbody = 'Mail::Message::Body::Lines'; | |||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||
| 608 | sub readBody($$;$$) | ||||||||||||||||||||||||||||||||
| 609 | 12 | ▶ | { my ($self, $parser, $head, $getbodytype) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
readBody: called CC=11 SCAR=25.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||
| 611 | my $bodytype | ||||||||||||||||||||||||||||||||
| 612 | 12 | ▶ | = ! $getbodytype ? ($self->{MM_body_type} || $lbody) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$self->{"MM_body_type"} or $lbody
MC/DC0%0/2
$self->{"MM_body_type"} or $lbody
$self->{"MM_body_type"}
$lbody
Truth table33%1/3
A or B
A= $self->{"MM_body_type"}B= $lbody
| |||||||||||||||||||||||||||||||||
| 613 | : ref $getbodytype ? $getbodytype->($self, $head) | ||||||||||||||||||||||||||||||||
| 614 | : $getbodytype; | ||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||
| 616 | 12 | my $body; | |||||||||||||||||||||||||||||||
| 617 | 12 | ▶ | if($bodytype->isDelayed) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 618 | 0 | { $body = $bodytype->new | |||||||||||||||||||||||||||||||
| 619 | ( message => $self | ||||||||||||||||||||||||||||||||
| 620 | , charset => 'us-ascii' | ||||||||||||||||||||||||||||||||
| 621 | , $self->logSettings | ||||||||||||||||||||||||||||||||
| 622 | ); | ||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||
| 624 | else | ||||||||||||||||||||||||||||||||
| 625 | 12 | { my $ct = $head->get('Content-Type', 0); | |||||||||||||||||||||||||||||||
| 626 | 12 | ▶ | my $type = defined $ct ? lc($ct->body) : 'text/plain'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||
| 628 | # Be sure you have acceptable bodies for multiparts and nested. | ||||||||||||||||||||||||||||||||
| 629 | 12 | ▶ | if(substr($type, 0, 10) eq 'multipart/' && !$bodytype->isMultipart) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
substr($type, 0, 10) eq "multipart/" and not $bodytype->isMultipart
MC/DC50%1/2
substr($type, 0, 10) eq "multipart/" and not $bodytype->isMultipart
substr($type, 0, 10) eq "multipart/"
not $bodytype->isMultipart
Truth table66%2/3
A and not(B)
A= substr($type, 0, 10) eq "multipart/"B= not $bodytype->isMultipart
| |||||||||||||||||||||||||||||||||
| 630 | 2 | { $bodytype = $mpbody } | |||||||||||||||||||||||||||||||
| 631 | ▶ | elsif($type eq 'message/rfc822' && !$bodytype->isNested) | |||||||||||||||||||||||||||||||
|
Condition66%2/3
$type eq "message/rfc822" and not $bodytype->isNested
MC/DC50%1/2
$type eq "message/rfc822" and not $bodytype->isNested
$type eq "message/rfc822"
not $bodytype->isNested
Truth table66%2/3
A and not(B)
A= $type eq "message/rfc822"B= not $bodytype->isNested
| |||||||||||||||||||||||||||||||||
| 632 | 1 | { $bodytype = $nbody } | |||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||
| 634 | $body = $bodytype->new | ||||||||||||||||||||||||||||||||
| 635 | ( message => $self | ||||||||||||||||||||||||||||||||
| 636 | , checked => $self->{MM_trusted} | ||||||||||||||||||||||||||||||||
| 637 | 12 | , charset => 'us-ascii' | |||||||||||||||||||||||||||||||
| 638 | , $self->logSettings | ||||||||||||||||||||||||||||||||
| 639 | ); | ||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||
| 641 | 12 | $body->contentInfoFrom($head); | |||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||
| 644 | 12 | my $lines = $head->get('Lines'); # usually off-by-one | |||||||||||||||||||||||||||||||
| 645 | 12 | my $size = $head->guessBodySize; | |||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||
| 647 | 12 | ▶ | $body->read | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 648 | ( $parser, $head, $getbodytype, | ||||||||||||||||||||||||||||||||
| 649 | , $size, (defined $lines ? $lines : undef) | ||||||||||||||||||||||||||||||||
| 650 | ); | ||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||
| 654 | sub storeBody($) | ||||||||||||||||||||||||||||||||
| 655 | 12 | ▶ | { my ($self, $body) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
storeBody: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 656 | 12 | $self->{MM_body} = $body; | |||||||||||||||||||||||||||||||
| 657 | 12 | $body->message($self); | |||||||||||||||||||||||||||||||
| 658 | 12 | $body; | |||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||
| 662 | sub isDelayed() | ||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | { my $body = shift->body; | ||||||||||||||||||||||||||||||
|
Subroutine
isDelayed: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 664 | 0 | ▶ | !$body || $body->isDelayed; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||
| 668 | sub takeMessageId(;$) | ||||||||||||||||||||||||||||||||
| 669 | 128 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
takeMessageId: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 670 | 128 | ▶ | my $msgid = (@_ ? shift : $self->get('Message-ID')) || ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
(@_ ? shift() : $self->get('Message-ID')) || ''
MC/DC100%1/1
(@_ ? shift() : $self->get('Message-ID')) || ''
(@_ ? shift() : $self->get('Message-ID'))
Truth table100%2/2
A
A= (@_ ? shift() : $self->get('Message-ID'))
| |||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||
| 672 | 128 | ▶ | if($msgid =~ m/\<([^>]*)\>/s) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 673 | 42 | { $msgid = $1; | |||||||||||||||||||||||||||||||
| 674 | 42 | $msgid =~ s/\s//gs; | |||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||
| 677 | 128 | ▶ | $msgid = $self->head->createMessageId | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 678 | unless length $msgid; | ||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||
| 680 | 128 | $self->{MM_message_id} = $msgid; | |||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||
| 683 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||
| 686 | sub shortSize(;$) | ||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
shortSize: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||
| 688 | 0 | my $size = shift; | |||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | $size = $self->head->guessBodySize unless defined $size; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | !defined $size ? '?' | ||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||
| 692 | : $size < 1_000 ? sprintf "%3d " , $size | ||||||||||||||||||||||||||||||||
| 693 | : $size < 10_000 ? sprintf "%3.1fK", $size/1024 | ||||||||||||||||||||||||||||||||
| 694 | : $size < 1_000_000 ? sprintf "%3.0fK", $size/1024 | ||||||||||||||||||||||||||||||||
| 695 | : $size < 10_000_000 ? sprintf "%3.1fM", $size/(1024*1024) | ||||||||||||||||||||||||||||||||
| 696 | : sprintf "%3.0fM", $size/(1024*1024); | ||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||
| 700 | sub shortString() | ||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
shortString: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 702 | 0 | sprintf "%4s %-30.30s", $self->shortSize, $self->subject; | |||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||
| 705 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | sub destruct() { $_[0] = undef } | ||||||||||||||||||||||||||||||
|
Subroutine
destruct: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||
| 710 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||
| 713 | 31 | 1; | |||||||||||||||||||||||||||||||