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