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