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::Field::Flex; |
10
|
3
|
|
|
3
|
|
5400
|
use vars '$VERSION'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
174
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.011'; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
19
|
use base 'Mail::Message::Field'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
656
|
|
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
77
|
|
16
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
71
|
|
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2127
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new($;$$@) |
22
|
18
|
|
|
18
|
1
|
2230
|
{ my $class = shift; |
23
|
|
|
|
|
|
|
my $args = @_ <= 2 || ! ref $_[-1] ? {} |
24
|
18
|
50
|
66
|
|
|
70
|
: ref $_[-1] eq 'ARRAY' ? { @{pop @_} } |
|
1
|
100
|
|
|
|
3
|
|
25
|
|
|
|
|
|
|
: pop @_; |
26
|
|
|
|
|
|
|
|
27
|
18
|
100
|
|
|
|
67
|
my ($name, $body) = $class->consume(@_==1 ? (shift) : (shift, shift)); |
28
|
18
|
50
|
|
|
|
38
|
return () unless defined $body; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Attributes preferably stored in array to protect order. |
31
|
18
|
|
|
|
|
30
|
my $attr = $args->{attributes}; |
32
|
18
|
50
|
33
|
|
|
36
|
$attr = [ %$attr ] if defined $attr && ref $attr eq 'HASH'; |
33
|
18
|
|
|
|
|
33
|
push @$attr, @_; |
34
|
|
|
|
|
|
|
|
35
|
18
|
|
|
|
|
70
|
$class->SUPER::new(%$args, name => $name, body => $body, |
36
|
|
|
|
|
|
|
attributes => $attr); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub init($) |
40
|
18
|
|
|
18
|
0
|
33
|
{ my ($self, $args) = @_; |
41
|
|
|
|
|
|
|
|
42
|
18
|
|
|
|
|
118
|
@$self{ qw/MMFF_name MMFF_body/ } = @$args{ qw/name body/ }; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->comment($args->{comment}) |
45
|
18
|
100
|
|
|
|
65
|
if exists $args->{comment}; |
46
|
|
|
|
|
|
|
|
47
|
18
|
|
|
|
|
40
|
my $attr = $args->{attributes}; |
48
|
18
|
|
|
|
|
37
|
$self->attribute(shift @$attr, shift @$attr) |
49
|
|
|
|
|
|
|
while @$attr; |
50
|
|
|
|
|
|
|
|
51
|
18
|
|
|
|
|
79
|
$self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------------------ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub clone() |
57
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
58
|
0
|
|
|
|
|
0
|
(ref $self)->new($self->Name, $self->body); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#------------------------------------------ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub length() |
64
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
65
|
0
|
|
|
|
|
0
|
length($self->{MMFF_name}) + 1 + length($self->{MMFF_body}); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#------------------------------------------ |
69
|
|
|
|
|
|
|
|
70
|
27
|
|
|
27
|
1
|
93
|
sub name() { lc shift->{MMFF_name}} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#------------------------------------------ |
73
|
|
|
|
|
|
|
|
74
|
5
|
|
|
5
|
1
|
15
|
sub Name() { shift->{MMFF_name}} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#------------------------------------------ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub folded(;$) |
79
|
8
|
|
|
8
|
1
|
11
|
{ my $self = shift; |
80
|
|
|
|
|
|
|
return $self->{MMFF_name}.':'.$self->{MMFF_body} |
81
|
8
|
100
|
|
|
|
38
|
unless wantarray; |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
8
|
my @lines = $self->foldedBody; |
84
|
2
|
|
|
|
|
6
|
my $first = $self->{MMFF_name}. ':'. shift @lines; |
85
|
2
|
|
|
|
|
7
|
($first, @lines); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#------------------------------------------ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub unfoldedBody($;@) |
91
|
38
|
|
|
38
|
1
|
1804
|
{ my $self = shift; |
92
|
38
|
100
|
|
|
|
81
|
$self->{MMFF_body} = $self->fold($self->{MMFF_name}, @_) |
93
|
|
|
|
|
|
|
if @_; |
94
|
|
|
|
|
|
|
|
95
|
38
|
|
|
|
|
100
|
$self->unfold($self->{MMFF_body}); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#------------------------------------------ |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub foldedBody($) |
101
|
13
|
|
|
13
|
1
|
30
|
{ my ($self, $body) = @_; |
102
|
13
|
100
|
|
|
|
30
|
if(@_==2) { $self->{MMFF_body} = $body } |
|
3
|
|
|
|
|
7
|
|
103
|
10
|
|
|
|
|
19
|
else { $body = $self->{MMFF_body} } |
104
|
|
|
|
|
|
|
|
105
|
13
|
100
|
|
|
|
55
|
wantarray ? (split /^/, $body) : $body; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#------------------------------------------ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |