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