line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2023 by [Mark Overmeer ]. |
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
|
4
|
|
|
4
|
|
1085
|
use vars '$VERSION'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
245
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.013'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
31
|
use strict; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
92
|
|
15
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
120
|
|
|
4
|
|
|
|
|
152
|
|
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
24
|
use IO::Lines; |
|
4
|
|
|
|
|
79
|
|
|
4
|
|
|
|
|
1921
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub string() |
21
|
5
|
|
|
5
|
1
|
467
|
{ my $self = shift; |
22
|
5
|
|
|
|
|
18
|
$self->head->string . $self->body->string; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#------------------------------------------ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub lines() |
29
|
8
|
|
|
8
|
1
|
15
|
{ my $self = shift; |
30
|
8
|
|
|
|
|
10
|
my @lines; |
31
|
8
|
|
|
|
|
48
|
my $file = IO::Lines->new(\@lines); |
32
|
8
|
|
|
|
|
407
|
$self->print($file); |
33
|
8
|
50
|
|
|
|
40
|
wantarray ? @lines : \@lines; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#------------------------------------------ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub file() |
40
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
41
|
0
|
|
|
|
|
0
|
my @lines; |
42
|
0
|
|
|
|
|
0
|
my $file = IO::Lines->new(\@lines); |
43
|
0
|
|
|
|
|
0
|
$self->print($file); |
44
|
0
|
|
|
|
|
0
|
$file->seek(0,0); |
45
|
0
|
|
|
|
|
0
|
$file; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub printStructure(;$$) |
50
|
6
|
|
|
6
|
1
|
15
|
{ my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
6
|
50
|
33
|
|
|
21
|
my $indent |
|
|
100
|
|
|
|
|
|
53
|
|
|
|
|
|
|
= @_==2 ? pop |
54
|
|
|
|
|
|
|
: defined $_[0] && !ref $_[0] ? shift |
55
|
|
|
|
|
|
|
: ''; |
56
|
|
|
|
|
|
|
|
57
|
6
|
50
|
|
|
|
12
|
my $fh = @_ ? shift : select; |
58
|
|
|
|
|
|
|
|
59
|
6
|
|
|
|
|
9
|
my $buffer; # only filled if filehandle==undef |
60
|
6
|
50
|
|
|
|
13
|
open $fh, '>:raw', \$buffer unless defined $fh; |
61
|
|
|
|
|
|
|
|
62
|
6
|
|
100
|
|
|
17
|
my $subject = $self->get('Subject') || ''; |
63
|
6
|
100
|
|
|
|
17
|
$subject = ": $subject" if length $subject; |
64
|
|
|
|
|
|
|
|
65
|
6
|
|
50
|
|
|
17
|
my $type = $self->get('Content-Type', 0) || ''; |
66
|
6
|
|
|
|
|
18
|
my $size = $self->size; |
67
|
6
|
50
|
|
|
|
16
|
my $deleted = $self->label('deleted') ? ', deleted' : ''; |
68
|
|
|
|
|
|
|
|
69
|
6
|
|
|
|
|
23
|
my $text = "$indent$type$subject ($size bytes$deleted)\n"; |
70
|
6
|
50
|
|
|
|
55
|
ref $fh eq 'GLOB' ? (print $fh $text) : $fh->print($text); |
71
|
|
|
|
|
|
|
|
72
|
6
|
|
|
|
|
134
|
my $body = $self->body; |
73
|
|
|
|
|
|
|
my @parts |
74
|
6
|
100
|
|
|
|
34
|
= $body->isNested ? ($body->nested) |
|
|
100
|
|
|
|
|
|
75
|
|
|
|
|
|
|
: $body->isMultipart ? $body->parts |
76
|
|
|
|
|
|
|
: (); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$_->printStructure($fh, $indent.' ') |
79
|
6
|
|
|
|
|
43
|
for @parts; |
80
|
|
|
|
|
|
|
|
81
|
6
|
|
|
|
|
16
|
$buffer; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |