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::Fast; |
10
|
43
|
|
|
43
|
|
3733
|
use vars '$VERSION'; |
|
43
|
|
|
|
|
1890
|
|
|
43
|
|
|
|
|
5601
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.013'; |
12
|
|
|
|
|
|
|
|
13
|
43
|
|
|
43
|
|
269
|
use base 'Mail::Message::Field'; |
|
43
|
|
|
|
|
104
|
|
|
43
|
|
|
|
|
20904
|
|
14
|
|
|
|
|
|
|
|
15
|
43
|
|
|
43
|
|
345
|
use strict; |
|
43
|
|
|
|
|
105
|
|
|
43
|
|
|
|
|
1022
|
|
16
|
43
|
|
|
43
|
|
225
|
use warnings; |
|
43
|
|
|
|
|
102
|
|
|
43
|
|
|
|
|
23708
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#------------------------------------------ |
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
# The DATA is stored as: [ NAME, FOLDED-BODY ] |
22
|
|
|
|
|
|
|
# The body is kept in a folded fashion, where each line starts with |
23
|
|
|
|
|
|
|
# a single blank. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new($;$@) |
27
|
921
|
|
|
921
|
1
|
20957
|
{ my $class = shift; |
28
|
|
|
|
|
|
|
|
29
|
921
|
100
|
|
|
|
3080
|
my ($name, $body) = $class->consume(@_==1 ? (shift) : (shift, shift)); |
30
|
921
|
50
|
|
|
|
2051
|
return () unless defined $body; |
31
|
|
|
|
|
|
|
|
32
|
921
|
|
|
|
|
2390
|
my $self = bless [$name, $body], $class; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Attributes |
35
|
921
|
100
|
|
|
|
2147
|
$self->comment(shift) if @_==1; # one attribute line |
36
|
921
|
|
|
|
|
1965
|
$self->attribute(shift, shift) while @_ > 1; # attribute pairs |
37
|
|
|
|
|
|
|
|
38
|
921
|
|
|
|
|
3403
|
$self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub clone() |
42
|
1481
|
|
|
1481
|
1
|
2217
|
{ my $self = shift; |
43
|
1481
|
|
|
|
|
5463
|
bless [ @$self ], ref $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub length() |
47
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
48
|
0
|
|
|
|
|
0
|
length($self->[0]) + 1 + length($self->[1]); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1625
|
|
|
1625
|
1
|
6303
|
sub name() { lc shift->[0] } |
52
|
16
|
|
|
16
|
1
|
59
|
sub Name() { shift->[0] } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub folded() |
55
|
259
|
|
|
259
|
1
|
396
|
{ my $self = shift; |
56
|
259
|
100
|
|
|
|
1300
|
return $self->[0].':'.$self->[1] |
57
|
|
|
|
|
|
|
unless wantarray; |
58
|
|
|
|
|
|
|
|
59
|
52
|
|
|
|
|
96
|
my @lines = $self->foldedBody; |
60
|
52
|
|
|
|
|
136
|
my $first = $self->[0]. ':'. shift @lines; |
61
|
52
|
|
|
|
|
161
|
($first, @lines); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub unfoldedBody($;@) |
65
|
1763
|
|
|
1763
|
1
|
4595
|
{ my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
1763
|
100
|
|
|
|
3821
|
$self->[1] = $self->fold($self->[0], @_) |
68
|
|
|
|
|
|
|
if @_; |
69
|
|
|
|
|
|
|
|
70
|
1763
|
|
|
|
|
4305
|
$self->unfold($self->[1]); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub foldedBody($) |
74
|
204
|
|
|
204
|
1
|
362
|
{ my ($self, $body) = @_; |
75
|
204
|
100
|
|
|
|
403
|
if(@_==2) { $self->[1] = $body } |
|
4
|
|
|
|
|
9
|
|
76
|
200
|
|
|
|
|
388
|
else { $body = $self->[1] } |
77
|
|
|
|
|
|
|
|
78
|
204
|
100
|
|
|
|
607
|
wantarray ? (split m/^/, $body) : $body; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# For performance reasons only |
82
|
|
|
|
|
|
|
sub print(;$) |
83
|
107
|
|
|
107
|
1
|
451
|
{ my $self = shift; |
84
|
107
|
|
33
|
|
|
217
|
my $fh = shift || select; |
85
|
107
|
50
|
|
|
|
516
|
if(ref $fh eq 'GLOB') { print $fh $self->[0].':'.$self->[1] } |
|
0
|
|
|
|
|
0
|
|
86
|
107
|
|
|
|
|
339
|
else { $fh->print($self->[0].':'.$self->[1]) } |
87
|
107
|
|
|
|
|
1280
|
$self; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |