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