| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyrights 2001-2022 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::Field::Structured; |
|
10
|
21
|
|
|
21
|
|
2096
|
use vars '$VERSION'; |
|
|
21
|
|
|
|
|
48
|
|
|
|
21
|
|
|
|
|
976
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.012'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
111
|
use base 'Mail::Message::Field::Full'; |
|
|
21
|
|
|
|
|
59
|
|
|
|
21
|
|
|
|
|
4736
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
21
|
|
|
21
|
|
147
|
use strict; |
|
|
21
|
|
|
|
|
40
|
|
|
|
21
|
|
|
|
|
473
|
|
|
16
|
21
|
|
|
21
|
|
100
|
use warnings; |
|
|
21
|
|
|
|
|
46
|
|
|
|
21
|
|
|
|
|
668
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
21
|
|
|
21
|
|
8334
|
use Mail::Message::Field::Attribute; |
|
|
21
|
|
|
|
|
55
|
|
|
|
21
|
|
|
|
|
675
|
|
|
19
|
21
|
|
|
21
|
|
136
|
use Storable 'dclone'; |
|
|
21
|
|
|
|
|
39
|
|
|
|
21
|
|
|
|
|
17168
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init($) |
|
23
|
106
|
|
|
106
|
0
|
329
|
{ my ($self, $args) = @_; |
|
24
|
106
|
|
|
|
|
789
|
$self->{MMFS_attrs} = {}; |
|
25
|
106
|
|
|
|
|
285
|
$self->{MMFS_datum} = $args->{datum}; |
|
26
|
|
|
|
|
|
|
|
|
27
|
106
|
|
|
|
|
514
|
$self->SUPER::init($args); |
|
28
|
|
|
|
|
|
|
|
|
29
|
106
|
|
50
|
|
|
489
|
my $attr = $args->{attributes} || []; |
|
30
|
106
|
50
|
|
|
|
391
|
$attr = [ %$attr ] if ref $attr eq 'HASH'; |
|
31
|
|
|
|
|
|
|
|
|
32
|
106
|
|
|
|
|
319
|
while(@$attr) |
|
33
|
0
|
|
|
|
|
0
|
{ my $name = shift @$attr; |
|
34
|
0
|
0
|
|
|
|
0
|
if(ref $name) { $self->attribute($name) } |
|
|
0
|
|
|
|
|
0
|
|
|
35
|
0
|
|
|
|
|
0
|
else { $self->attribute($name, shift @$attr) } |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
106
|
|
|
|
|
646
|
$self; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
177
|
|
|
177
|
1
|
9866
|
sub clone() { dclone(shift) } |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#------------------------------------------ |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub attribute($;$) |
|
47
|
285
|
|
|
285
|
1
|
1951
|
{ my ($self, $attr) = (shift, shift); |
|
48
|
285
|
|
|
|
|
388
|
my $name; |
|
49
|
285
|
100
|
|
|
|
756
|
if(ref $attr) { $name = $attr->name } |
|
|
67
|
100
|
|
|
|
202
|
|
|
50
|
178
|
|
|
|
|
790
|
elsif( !@_ ) { return $self->{MMFS_attrs}{lc $attr} } |
|
51
|
|
|
|
|
|
|
else |
|
52
|
40
|
|
|
|
|
82
|
{ $name = $attr; |
|
53
|
40
|
|
|
|
|
141
|
$attr = Mail::Message::Field::Attribute->new($name, @_); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
107
|
|
|
|
|
200
|
delete $self->{MMFF_body}; |
|
57
|
107
|
|
|
|
|
364
|
$self->{MMFS_attrs}{lc $name} = $attr; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
2
|
|
|
2
|
1
|
5
|
sub attributes() { values %{shift->{MMFS_attrs}} } |
|
|
2
|
|
|
|
|
15
|
|
|
62
|
7
|
|
|
7
|
1
|
19
|
sub beautify() { delete shift->{MMFF_body} } |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
0
|
sub attrPairs() { map +($_->name, $_->value), shift->attributes } |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#------------------------- |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub parse($) |
|
71
|
73
|
|
|
73
|
1
|
179
|
{ my ($self, $string) = @_; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# remove FWS, even within quoted strings |
|
74
|
73
|
|
|
|
|
546
|
$string =~ s/\r?\n\s?/ /gs; |
|
75
|
73
|
|
|
|
|
300
|
$string =~ s/ +$//; |
|
76
|
|
|
|
|
|
|
|
|
77
|
73
|
|
|
|
|
151
|
my $datum = ''; |
|
78
|
73
|
|
100
|
|
|
475
|
while(length $string && substr($string, 0, 1) ne ';') |
|
79
|
75
|
|
|
|
|
343
|
{ (undef, $string) = $self->consumeComment($string); |
|
80
|
75
|
100
|
|
|
|
649
|
$datum .= $1 if $string =~ s/^([^;(]+)//; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
73
|
|
|
|
|
248
|
$self->{MMFS_datum} = $datum; |
|
83
|
|
|
|
|
|
|
|
|
84
|
73
|
|
|
|
|
147
|
my $found = ''; |
|
85
|
73
|
|
|
|
|
317
|
while($string =~ m/\S/) |
|
86
|
137
|
|
|
|
|
228
|
{ my $len = length $string; |
|
87
|
|
|
|
|
|
|
|
|
88
|
137
|
100
|
100
|
|
|
670
|
if($string =~ s/^\s*\;\s*// && length $found) |
|
89
|
5
|
|
|
|
|
18
|
{ my ($name) = $found =~ m/^([^*]+)\*/; |
|
90
|
5
|
100
|
100
|
|
|
20
|
if($name && (my $cont = $self->attribute($name))) |
|
91
|
1
|
|
|
|
|
3
|
{ $cont->addComponent($found); # continuation |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
else |
|
94
|
4
|
|
|
|
|
18
|
{ my $attr = Mail::Message::Field::Attribute->new($found); |
|
95
|
4
|
|
|
|
|
12
|
$self->attribute($attr); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
5
|
|
|
|
|
10
|
$found = ''; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
137
|
|
|
|
|
384
|
(undef, $string) = $self->consumeComment($string); |
|
101
|
137
|
|
|
|
|
272
|
$string =~ s/^\n//; |
|
102
|
137
|
|
|
|
|
477
|
(my $text, $string) = $self->consumePhrase($string); |
|
103
|
137
|
100
|
|
|
|
354
|
$found .= $text if defined $text; |
|
104
|
|
|
|
|
|
|
|
|
105
|
137
|
50
|
|
|
|
477
|
if(length($string) == $len) |
|
106
|
|
|
|
|
|
|
{ # nothing consumed, remove character to avoid endless loop |
|
107
|
0
|
|
|
|
|
0
|
$string =~ s/^\s*\S//; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
73
|
100
|
|
|
|
232
|
if(length $found) |
|
112
|
65
|
|
|
|
|
167
|
{ my ($name) = $found =~ m/^([^*]+)\*/; |
|
113
|
65
|
100
|
66
|
|
|
215
|
if($name && (my $cont = $self->attribute($name))) |
|
114
|
2
|
|
|
|
|
5
|
{ $cont->addComponent($found); # continuation |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
else |
|
117
|
63
|
|
|
|
|
374
|
{ my $attr = Mail::Message::Field::Attribute->new($found); |
|
118
|
63
|
|
|
|
|
204
|
$self->attribute($attr); |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
73
|
|
|
|
|
164
|
1; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub produceBody() |
|
126
|
46
|
|
|
46
|
1
|
435
|
{ my $self = shift; |
|
127
|
46
|
|
|
|
|
160
|
my $attrs = $self->{MMFS_attrs}; |
|
128
|
46
|
|
|
|
|
104
|
my $datum = $self->{MMFS_datum}; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
join '; ' |
|
131
|
|
|
|
|
|
|
, (defined $datum ? $datum : '') |
|
132
|
46
|
100
|
|
|
|
263
|
, map {$_->string} @{$attrs}{sort keys %$attrs}; |
|
|
44
|
|
|
|
|
178
|
|
|
|
46
|
|
|
|
|
164
|
|
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub datum(@) |
|
137
|
2
|
|
|
2
|
1
|
342
|
{ my $self = shift; |
|
138
|
2
|
100
|
|
|
|
14
|
@_ or return $self->{MMFS_datum}; |
|
139
|
1
|
|
|
|
|
3
|
delete $self->{MMFF_body}; |
|
140
|
1
|
|
|
|
|
5
|
$self->{MMFS_datum} = shift; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1; |