| 1 | # Copyrights 2001-2023 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 | 3 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 11 | 3 | $VERSION = '3.013'; | |||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use Mail::Message::Body::Multipart; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use Mail::Message::Body::Nested; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||
| 22 | # tests in t/57forw1f.t | ||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | sub forward(@) | ||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forward: called CC=8 SCAR=33.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 26 | 3 | my %args = @_; | |||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||
| 28 | return $self->forwardNo(@_) | ||||||||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | if exists $args{body}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | my $include = $args{include} || 'INLINE'; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'include'} || 'INLINE'
MC/DC0%0/1
$args{'include'} || 'INLINE'
$args{'include'}
Truth table50%1/2
A
A= $args{'include'}
| |||||||||||||||||||||||||||||||||||||||
| 32 | 3 | ▶ | return $self->forwardInline(@_) if $include eq 'INLINE'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $preamble = $args{preamble}; | |||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | push @_, preamble => Mail::Message::Body->new(data => $preamble) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $preamble and not ref $preamble
MC/DC0%0/2
defined $preamble and not ref $preamble
defined $preamble
not ref $preamble
Truth table0%0/3
A and not(B)
A= defined $preambleB= not ref $preamble
| |||||||||||||||||||||||||||||||||||||||
| 36 | if defined $preamble && ! ref $preamble; | ||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | return $self->forwardAttach(@_) if $include eq 'ATTACH'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return $self->forwardEncapsulate(@_) if $include eq 'ENCAPSULATE'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->log(ERROR => 'Cannot include forward source as $include.'); | |||||||||||||||||||||||||||||||||||||
| 42 | 0 | undef; | |||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||
| 45 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||
| 48 | sub forwardNo(@) | ||||||||||||||||||||||||||||||||||||||
| 49 | 7 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardNo: called CC=15 SCAR=29.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||
| 51 | 7 | my $body = $args{body}; | |||||||||||||||||||||||||||||||||||||
| 52 | 7 | ▶ | $self->log(INTERNAL => "No body supplied for forwardNo()") | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 53 | unless defined $body; | ||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||
| 55 | # | ||||||||||||||||||||||||||||||||||||||
| 56 | # Collect header info | ||||||||||||||||||||||||||||||||||||||
| 57 | # | ||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||
| 59 | 7 | my $mainhead = $self->toplevel->head; | |||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | # Where it comes from | ||||||||||||||||||||||||||||||||||||||
| 62 | 7 | my $from = $args{From}; | |||||||||||||||||||||||||||||||||||||
| 63 | 7 | ▶ | unless(defined $from) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 64 | 7 | { my @from = $self->to; | |||||||||||||||||||||||||||||||||||||
| 65 | 7 | ▶ | $from = \@from if @from; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||
| 68 | # To whom to send | ||||||||||||||||||||||||||||||||||||||
| 69 | 7 | my $to = $args{To}; | |||||||||||||||||||||||||||||||||||||
| 70 | 7 | ▶ | $self->log(ERROR => "No address to create forwarded to."), return | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 71 | unless $to; | ||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||
| 73 | # Create a subject | ||||||||||||||||||||||||||||||||||||||
| 74 | 7 | my $srcsub = $args{Subject}; | |||||||||||||||||||||||||||||||||||||
| 75 | 7 | ▶ | my $subject | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 76 | = ! defined $srcsub ? $self->forwardSubject($self->subject) | ||||||||||||||||||||||||||||||||||||||
| 77 | : ref $srcsub ? $srcsub->($self->subject) | ||||||||||||||||||||||||||||||||||||||
| 78 | : $srcsub; | ||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||
| 80 | # Create a nice message-id | ||||||||||||||||||||||||||||||||||||||
| 81 | 7 | ▶ | my $msgid = $args{'Message-ID'} || $mainhead->createMessageId; | ||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{'Message-ID'} || $mainhead->createMessageId
MC/DC0%0/2
$args{'Message-ID'} || $mainhead->createMessageId
$args{'Message-ID'}
$mainhead->createMessageId
Truth table33%1/3
A || B
A= $args{'Message-ID'}B= $mainhead->createMessageId
| |||||||||||||||||||||||||||||||||||||||
| 82 | 7 | ▶ | $msgid = "<$msgid>" if $msgid && $msgid !~ /^\s*\<.*\>\s*$/; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$msgid and not $msgid =~ /^\s*\<.*\>\s*$/
MC/DC0%0/2
$msgid and not $msgid =~ /^\s*\<.*\>\s*$/
$msgid
not $msgid =~ /^\s*\<.*\>\s*$/
Truth table33%1/3
A and not(B)
A= $msgidB= not $msgid =~ /^\s*\<.*\>\s*$/
| |||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||
| 84 | # Thread information | ||||||||||||||||||||||||||||||||||||||
| 85 | 7 | my $origid = '<'.$self->messageId.'>'; | |||||||||||||||||||||||||||||||||||||
| 86 | 7 | my $refs = $mainhead->get('references'); | |||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||
| 88 | 7 | ▶ | my $forward = Mail::Message->buildFromBody | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$from || '(undisclosed)'
MC/DC0%0/1
$from || '(undisclosed)'
$from
Truth table50%1/2
A
A= $from
| |||||||||||||||||||||||||||||||||||||||
| 89 | ( $body | ||||||||||||||||||||||||||||||||||||||
| 90 | , From => ($from || '(undisclosed)') | ||||||||||||||||||||||||||||||||||||||
| 91 | , To => $to | ||||||||||||||||||||||||||||||||||||||
| 92 | , Subject => $subject | ||||||||||||||||||||||||||||||||||||||
| 93 | , References => ($refs ? "$refs $origid" : $origid) | ||||||||||||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||
| 96 | 7 | my $newhead = $forward->head; | |||||||||||||||||||||||||||||||||||||
| 97 | 7 | ▶ | $newhead->set(Cc => $args{Cc} ) if $args{Cc}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 98 | 7 | ▶ | $newhead->set(Bcc => $args{Bcc} ) if $args{Bcc}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 99 | 7 | ▶ | $newhead->set(Date => $args{Date}) if $args{Date}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||
| 101 | # Ready | ||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||
| 103 | 7 | $self->label(passed => 1); | |||||||||||||||||||||||||||||||||||||
| 104 | 7 | $self->log(PROGRESS => "Forward created from $origid"); | |||||||||||||||||||||||||||||||||||||
| 105 | 7 | $forward; | |||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||
| 108 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||
| 111 | sub forwardInline(@) | ||||||||||||||||||||||||||||||||||||||
| 112 | 4 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardInline: called CC=20 SCAR=32.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||
| 114 | 4 | my $body = $self->body; | |||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||
| 116 | 4 | while(1) # simplify | |||||||||||||||||||||||||||||||||||||
| 117 | 4 | ▶ | { if($body->isMultipart && $body->parts==1) | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$body->isMultipart and $body->parts == 1
MC/DC0%0/2
$body->isMultipart and $body->parts == 1
$body->isMultipart
$body->parts == 1
Truth table33%1/3
A and B
A= $body->isMultipartB= $body->parts == 1
| |||||||||||||||||||||||||||||||||||||||
| 118 | 0 | { $body = $body->part(0)->body } | |||||||||||||||||||||||||||||||||||||
| 119 | 0 | elsif($body->isNested) { $body = $body->nested->body } | |||||||||||||||||||||||||||||||||||||
| 120 | 4 | else { last } | |||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||
| 123 | # Prelude must be a real body, otherwise concatenate will not work | ||||||||||||||||||||||||||||||||||||||
| 124 | my $prelude = exists $args{prelude} ? $args{prelude} | ||||||||||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | : $self->forwardPrelude; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||
| 127 | 4 | ▶ | $prelude = Mail::Message::Body->new(data => $prelude) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $prelude and not builtin::blessed($prelude)
MC/DC50%1/2
defined $prelude and not builtin::blessed($prelude)
defined $prelude
not builtin::blessed($prelude)
Truth table66%2/3
A and not(B)
A= defined $preludeB= not builtin::blessed($prelude)
| |||||||||||||||||||||||||||||||||||||||
| 128 | if defined $prelude && ! blessed $prelude; | ||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||
| 130 | # Postlude | ||||||||||||||||||||||||||||||||||||||
| 131 | my $postlude = exists $args{postlude} ? $args{postlude} | ||||||||||||||||||||||||||||||||||||||
| 132 | 4 | ▶ | : $self->forwardPostlude; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||
| 134 | # Binary bodies cannot be inlined, therefore they will be rewritten | ||||||||||||||||||||||||||||||||||||||
| 135 | # into a forwardAttach... preamble must replace prelude and postlude. | ||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||
| 137 | 4 | ▶ | if($body->isMultipart || $body->isBinary) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$body->isMultipart or $body->isBinary
MC/DC50%1/2
$body->isMultipart or $body->isBinary
$body->isMultipart
$body->isBinary
Truth table66%2/3
A or B
A= $body->isMultipartB= $body->isBinary
| |||||||||||||||||||||||||||||||||||||||
| 138 | { $args{preamble} ||= $prelude->concatenate | ||||||||||||||||||||||||||||||||||||||
| 139 | ( $prelude | ||||||||||||||||||||||||||||||||||||||
| 140 | 1 | ▶ | , ($args{is_attached} || "[The forwarded message is attached]\n") | ||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$args{"preamble"} ||= $prelude->concatenate($prelude, $args{"is_attached"} || "[The forwarded message is attached]\n", $postlude)
$args{'is_attached'} || "[The forwarded message is attached]\n"
MC/DC0%0/2
$args{"preamble"} ||= $prelude->concatenate($prelude, $args{"is_attached"} || "[The forwarded message is attached]\n", $postlude)
$args{"preamble"}
$prelude->concatenate($prelude, $args{"is_attached"} || "[The forwarded message is attached]\n", $postlude)
MC/DC0%0/1
$args{'is_attached'} || "[The forwarded message is attached]\n"
$args{'is_attached'}
Truth table33%1/3
A ||= B
A= $args{"preamble"}B= $prelude->concatenate($prelude, $args{"is_attached"} || "[The forwarded message is attached]\n", $postlude)
Truth table50%1/2
A
A= $args{'is_attached'}
| |||||||||||||||||||||||||||||||||||||||
| 141 | , $postlude | ||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||
| 143 | 1 | return $self->forwardAttach(%args); | |||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||
| 146 | 3 | $body = $body->decoded; | |||||||||||||||||||||||||||||||||||||
| 147 | my $strip = (!exists $args{strip_signature} || $args{strip_signature}) | ||||||||||||||||||||||||||||||||||||||
| 148 | 3 | ▶ | && !$body->isNested; | ||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
(!exists $args{'strip_signature'} || $args{'strip_signature'}) && !$body->isNested
not exists $args{"strip_signature"} or $args{"strip_signature"}
MC/DC33%1/3
(!exists $args{'strip_signature'} || $args{'strip_signature'}) && !$body->isNested
not exists $args{"strip_signature"}
$args{"strip_signature"}
!$body->isNested
Truth table40%2/5
not(A) or B && not(C)
A= not exists $args{"strip_signature"}B= $args{"strip_signature"}C= !$body->isNested
| |||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||
| 150 | $body = $body->stripSignature | ||||||||||||||||||||||||||||||||||||||
| 151 | ( pattern => $args{strip_signature} | ||||||||||||||||||||||||||||||||||||||
| 152 | , max_lines => $args{max_signature} | ||||||||||||||||||||||||||||||||||||||
| 153 | 3 | ▶ | ) if $strip; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||
| 155 | 3 | ▶ | if(defined(my $quote = $args{quote})) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 156 | 2 | ▶ | { my $quoting = ref $quote ? $quote : sub {$quote . $_}; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 157 | 2 | $body = $body->foreachLine($quoting); | |||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||
| 160 | # | ||||||||||||||||||||||||||||||||||||||
| 161 | # Create the message. | ||||||||||||||||||||||||||||||||||||||
| 162 | # | ||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||
| 164 | 3 | my $signature = $args{signature}; | |||||||||||||||||||||||||||||||||||||
| 165 | 3 | ▶ | $signature = $signature->body | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $signature and $signature->isa("Mail::Message")
MC/DC0%0/2
defined $signature and $signature->isa("Mail::Message")
defined $signature
$signature->isa("Mail::Message")
Truth table33%1/3
A and B
A= defined $signatureB= $signature->isa("Mail::Message")
| |||||||||||||||||||||||||||||||||||||||
| 166 | if defined $signature && $signature->isa('Mail::Message'); | ||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||
| 168 | 3 | ▶ | my $composed = $body->concatenate | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 169 | ( $prelude, $body, $postlude | ||||||||||||||||||||||||||||||||||||||
| 170 | , (defined $signature ? "-- \n" : undef), $signature | ||||||||||||||||||||||||||||||||||||||
| 171 | ); | ||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||
| 173 | 3 | $self->forwardNo(%args, body => $composed); | |||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||
| 176 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||
| 179 | sub forwardAttach(@) | ||||||||||||||||||||||||||||||||||||||
| 180 | 3 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardAttach: called CC=7 SCAR=20.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||
| 182 | 3 | my $body = $self->body; | |||||||||||||||||||||||||||||||||||||
| 183 | 3 | ▶ | my $strip = !exists $args{strip_signature} || $args{strip_signature}; | ||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
!exists $args{'strip_signature'} || $args{'strip_signature'}
MC/DC0%0/2
!exists $args{'strip_signature'} || $args{'strip_signature'}
!exists $args{'strip_signature'}
$args{'strip_signature'}
Truth table33%1/3
not(A) || B
A= !exists $args{'strip_signature'}B= $args{'strip_signature'}
| |||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||
| 185 | 3 | ▶ | if($body->isMultipart) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 186 | 1 | ▶ | { $body = $body->stripSignature if $strip; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | $body = $body->part(0)->body if $body->parts == 1; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||
| 190 | 3 | my $preamble = $args{preamble}; | |||||||||||||||||||||||||||||||||||||
| 191 | 3 | ▶ | $self->log(ERROR => 'Method forwardAttach requires a preamble'), return | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 192 | unless ref $preamble; | ||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||
| 194 | 3 | my @parts = ($preamble, $body); | |||||||||||||||||||||||||||||||||||||
| 195 | 3 | ▶ | push @parts, $args{signature} if defined $args{signature}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 196 | 3 | my $multi = Mail::Message::Body::Multipart->new(parts => \@parts); | |||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||
| 198 | 3 | $self->forwardNo(%args, body => $multi); | |||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||
| 201 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||
| 204 | sub forwardEncapsulate(@) | ||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | { my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardEncapsulate: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||
| 207 | 1 | my $preamble = $args{preamble}; | |||||||||||||||||||||||||||||||||||||
| 208 | 1 | ▶ | $self->log(ERROR => 'Method forwardEncapsulate requires a preamble'), return | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 209 | unless ref $preamble; | ||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||
| 211 | 1 | my $nested= Mail::Message::Body::Nested->new(nested => $self->clone); | |||||||||||||||||||||||||||||||||||||
| 212 | 1 | my @parts = ($preamble, $nested); | |||||||||||||||||||||||||||||||||||||
| 213 | 1 | ▶ | push @parts, $args{signature} if defined $args{signature}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||
| 215 | 1 | my $multi = Mail::Message::Body::Multipart->new(parts => \@parts); | |||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||
| 217 | 1 | $self->forwardNo(%args, body => $multi); | |||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||
| 220 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||
| 223 | # tests in t/57forw0s.t | ||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||
| 225 | sub forwardSubject($) | ||||||||||||||||||||||||||||||||||||||
| 226 | 14 | ▶ | { my ($self, $subject) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardSubject: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 227 | 14 | ▶ | defined $subject && length $subject ? "Forw: $subject" : "Forwarded"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $subject and length $subject
MC/DC100%2/2
defined $subject and length $subject
defined $subject
length $subject
Truth table100%3/3
A and B
A= defined $subjectB= length $subject
| |||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||
| 230 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||
| 233 | sub forwardPrelude() | ||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | { my $head = shift->head; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardPrelude: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||
| 236 | 1 | my @lines = "---- BEGIN forwarded message\n"; | |||||||||||||||||||||||||||||||||||||
| 237 | 1 | my $from = $head->get('from'); | |||||||||||||||||||||||||||||||||||||
| 238 | 1 | my $to = $head->get('to'); | |||||||||||||||||||||||||||||||||||||
| 239 | 1 | my $cc = $head->get('cc'); | |||||||||||||||||||||||||||||||||||||
| 240 | 1 | my $date = $head->get('date'); | |||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||
| 242 | 1 | ▶ | push @lines, $from->string if defined $from; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 243 | 1 | ▶ | push @lines, $to->string if defined $to; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 244 | 1 | ▶ | push @lines, $cc->string if defined $cc; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 245 | 1 | ▶ | push @lines, $date->string if defined $date; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 246 | 1 | push @lines, "\n"; | |||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||
| 248 | 1 | \@lines; | |||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||
| 251 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||
| 254 | sub forwardPostlude() | ||||||||||||||||||||||||||||||||||||||
| 255 | 1 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
forwardPostlude: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 256 | 1 | my @lines = ("---- END forwarded message\n"); | |||||||||||||||||||||||||||||||||||||
| 257 | 1 | \@lines; | |||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||
| 260 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||
| 263 | #------------------------------------------ | ||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||
| 265 | 3 | 1; | |||||||||||||||||||||||||||||||||||||