| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution Mail-Message version 4.04. |
|
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::Body::Nested;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '4.04'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
37
|
|
|
37
|
|
283
|
use parent 'Mail::Message::Body'; |
|
|
37
|
|
|
|
|
89
|
|
|
|
37
|
|
|
|
|
369
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
37
|
|
|
37
|
|
3547
|
use strict; |
|
|
37
|
|
|
|
|
82
|
|
|
|
37
|
|
|
|
|
1227
|
|
|
19
|
37
|
|
|
37
|
|
216
|
use warnings; |
|
|
37
|
|
|
|
|
97
|
|
|
|
37
|
|
|
|
|
2657
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
37
|
|
|
37
|
|
250
|
use Log::Report 'mail-message', import => [ qw/__x error/ ]; |
|
|
37
|
|
|
|
|
156
|
|
|
|
37
|
|
|
|
|
552
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
37
|
|
|
37
|
|
9039
|
use Mail::Message::Body::Lines (); |
|
|
37
|
|
|
|
|
84
|
|
|
|
37
|
|
|
|
|
968
|
|
|
24
|
37
|
|
|
37
|
|
194
|
use Mail::Message::Part (); |
|
|
37
|
|
|
|
|
82
|
|
|
|
37
|
|
|
|
|
45284
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#-------------------- |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub init($) |
|
29
|
12
|
|
|
12
|
0
|
36
|
{ my ($self, $args) = @_; |
|
30
|
12
|
|
50
|
|
|
3629
|
$args->{mime_type} ||= 'message/rfc822'; |
|
31
|
|
|
|
|
|
|
|
|
32
|
12
|
|
|
|
|
77
|
$self->SUPER::init($args); |
|
33
|
|
|
|
|
|
|
|
|
34
|
12
|
|
|
|
|
24
|
my $nested; |
|
35
|
12
|
100
|
|
|
|
49
|
if(my $raw = $args->{nested}) |
|
36
|
11
|
50
|
|
|
|
67
|
{ $nested = Mail::Message::Part->coerce($raw, $self) |
|
37
|
|
|
|
|
|
|
or error __x"data not convertible to a message (type is {class})", class => ref $raw; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
12
|
|
|
|
|
36
|
$self->{MMBN_nested} = $nested; |
|
41
|
12
|
|
|
|
|
73
|
$self; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub clone() |
|
45
|
1
|
|
|
1
|
1
|
1
|
{ my $self = shift; |
|
46
|
1
|
|
|
|
|
5
|
(ref $self)->new(based_on => $self, nested => $self->nested->clone); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub isNested() { 1 } |
|
50
|
0
|
|
|
0
|
1
|
0
|
sub isBinary() { $_[0]->nested->body->isBinary } |
|
51
|
11
|
|
|
11
|
1
|
39
|
sub nrLines() { $_[0]->nested->nrLines } |
|
52
|
13
|
|
|
13
|
1
|
43
|
sub size() { $_[0]->nested->size } |
|
53
|
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
1
|
1
|
6
|
sub string() { my $nested = $_[0]->nested; defined $nested ? $nested->string : '' } |
|
|
1
|
|
|
|
|
20
|
|
|
55
|
0
|
0
|
|
0
|
1
|
0
|
sub lines() { my $nested = $_[0]->nested; defined $nested ? $nested->lines : () } |
|
|
0
|
|
|
|
|
0
|
|
|
56
|
0
|
0
|
|
0
|
1
|
0
|
sub file() { my $nested = $_[0]->nested; defined $nested ? $nested->file : undef } |
|
|
0
|
|
|
|
|
0
|
|
|
57
|
3
|
|
33
|
3
|
1
|
6
|
sub print(;$) { my $self = shift; $self->nested->print(shift || select) } |
|
|
3
|
|
|
|
|
9
|
|
|
58
|
2
|
|
|
2
|
1
|
9
|
sub endsOnNewline() { $_[0]->nested->body->endsOnNewline } |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub partNumberOf($) |
|
61
|
3
|
|
|
3
|
1
|
8
|
{ my ($self, $part) = @_; |
|
62
|
3
|
100
|
|
|
|
10
|
$self->message->partNumber || '1'; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub foreachLine($) |
|
67
|
0
|
|
|
0
|
1
|
0
|
{ my ($self, $code) = @_; |
|
68
|
0
|
|
|
|
|
0
|
error __x"you cannot use foreachLine on a nested."; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
1
|
0
|
sub check() { $_[0]->forNested( sub { $_[1]->check } ) } |
|
|
0
|
|
|
0
|
|
0
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub encode(@) |
|
74
|
1
|
|
|
1
|
1
|
6
|
{ my ($self, %args) = @_; |
|
75
|
1
|
|
|
1
|
|
8
|
$self->forNested( sub { $_[1]->encode(%args) } ); |
|
|
1
|
|
|
|
|
7
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
7
|
|
|
7
|
1
|
37
|
sub encoded() { $_[0]->forNested( sub { $_[1]->encoded } ) } |
|
|
7
|
|
|
7
|
|
55
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub read($$$$) |
|
81
|
1
|
|
|
1
|
1
|
5
|
{ my ($self, $parser, $head, $bodytype) = @_; |
|
82
|
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
5
|
my $nest = Mail::Message::Part->new(container => undef); |
|
84
|
1
|
50
|
|
|
|
9
|
$nest->readFromParser($parser, $bodytype) or return; |
|
85
|
1
|
|
|
|
|
5
|
$nest->container($self); |
|
86
|
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
3
|
$self->{MMBN_nested} = $nest; |
|
88
|
1
|
|
|
|
|
5
|
$self; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub fileLocation() |
|
92
|
0
|
|
|
0
|
1
|
0
|
{ my $nested = $_[0]->nested; |
|
93
|
0
|
|
|
|
|
0
|
( ($nested->head->fileLocation)[0], ($nested->body->fileLocation)[1] ); |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub moveLocation($) |
|
97
|
0
|
|
|
0
|
1
|
0
|
{ my ($self, $dest) = @_; |
|
98
|
0
|
0
|
|
|
|
0
|
$dest or return $self; # no move |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
0
|
my $nested = $self->nested; |
|
101
|
0
|
|
|
|
|
0
|
$nested->head->moveLocation($dest); |
|
102
|
0
|
|
|
|
|
0
|
$nested->body->moveLocation($dest); |
|
103
|
0
|
|
|
|
|
0
|
$self; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#-------------------- |
|
107
|
|
|
|
|
|
|
|
|
108
|
63
|
|
|
63
|
1
|
356
|
sub nested() { $_[0]->{MMBN_nested} } |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub forNested($) |
|
112
|
8
|
|
|
8
|
1
|
21
|
{ my ($self, $code) = @_; |
|
113
|
8
|
|
|
|
|
28
|
my $nested = $self->nested; |
|
114
|
8
|
|
|
|
|
32
|
my $body = $nested->body; |
|
115
|
|
|
|
|
|
|
|
|
116
|
8
|
50
|
|
|
|
26
|
my $new_body = $code->($self, $body) or return; |
|
117
|
8
|
100
|
|
|
|
27
|
$new_body != $body or return $self; |
|
118
|
|
|
|
|
|
|
|
|
119
|
3
|
|
|
|
|
22
|
my $new_nested = Mail::Message::Part->new(head => $nested->head->clone, container => undef); |
|
120
|
3
|
|
|
|
|
17
|
$new_nested->body($new_body); |
|
121
|
|
|
|
|
|
|
|
|
122
|
3
|
|
|
|
|
20
|
my $created = (ref $self)->new(based_on => $self, nested => $new_nested); |
|
123
|
3
|
|
|
|
|
12
|
$new_nested->container($created); |
|
124
|
|
|
|
|
|
|
|
|
125
|
3
|
|
|
|
|
27
|
$created; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
0
|
0
|
|
sub toplevel() { my $msg = $_[0]->message; $msg ? $msg->toplevel : undef} |
|
|
0
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |