| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution Mail-Message version 4.04. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.06. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2001-2026 by Mark Overmeer. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
9
|
|
|
|
|
|
|
# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Mail::Message::Field::Fast;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '4.04'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
45
|
|
|
45
|
|
5578
|
use parent 'Mail::Message::Field'; |
|
|
45
|
|
|
|
|
92
|
|
|
|
45
|
|
|
|
|
379
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
45
|
|
|
45
|
|
3816
|
use strict; |
|
|
45
|
|
|
|
|
96
|
|
|
|
45
|
|
|
|
|
1406
|
|
|
19
|
45
|
|
|
45
|
|
260
|
use warnings; |
|
|
45
|
|
|
|
|
109
|
|
|
|
45
|
|
|
|
|
3061
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
45
|
|
|
45
|
|
302
|
use Log::Report 'mail-message', import => [ qw// ]; |
|
|
45
|
|
|
|
|
117
|
|
|
|
45
|
|
|
|
|
448
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
45
|
|
|
45
|
|
8813
|
use Scalar::Util qw/blessed/; |
|
|
45
|
|
|
|
|
101
|
|
|
|
45
|
|
|
|
|
31860
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#-------------------- |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# The DATA is stored as: [ NAME, FOLDED-BODY ] |
|
28
|
|
|
|
|
|
|
# The body is kept in a folded fashion, where each line starts with |
|
29
|
|
|
|
|
|
|
# a single blank. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new($;$@) |
|
33
|
1959
|
|
|
1959
|
1
|
906859
|
{ my $class = shift; |
|
34
|
|
|
|
|
|
|
|
|
35
|
1959
|
100
|
|
|
|
7154
|
my ($name, $body) = $class->consume(@_==1 ? (shift) : (shift, shift)); |
|
36
|
1959
|
50
|
|
|
|
8802
|
defined $body or return (); |
|
37
|
|
|
|
|
|
|
|
|
38
|
1959
|
|
|
|
|
5804
|
my $self = bless +[$name, $body], $class; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Attributes |
|
41
|
1959
|
100
|
|
|
|
4805
|
$self->comment(shift) if @_==1; # one attribute line |
|
42
|
1959
|
|
|
|
|
4482
|
$self->attribute(shift, shift) while @_ > 1; # attribute pairs |
|
43
|
1959
|
|
|
|
|
8113
|
$self; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub clone() |
|
47
|
1664
|
|
|
1664
|
1
|
2720
|
{ my $self = shift; |
|
48
|
1664
|
|
|
|
|
7695
|
bless +[ @$self ], ref $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub length() |
|
52
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
|
53
|
0
|
|
|
|
|
0
|
length($self->[0]) + 1 + length($self->[1]); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
5252
|
|
|
5252
|
1
|
23801
|
sub name() { lc shift->[0] } |
|
57
|
16
|
|
|
16
|
1
|
60
|
sub Name() { $_[0]->[0] } |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub folded() |
|
60
|
276
|
|
|
276
|
1
|
465
|
{ my $self = shift; |
|
61
|
276
|
100
|
|
|
|
1736
|
wantarray or return $self->[0] .':'. $self->[1]; |
|
62
|
|
|
|
|
|
|
|
|
63
|
52
|
|
|
|
|
116
|
my @lines = $self->foldedBody; |
|
64
|
52
|
|
|
|
|
114
|
my $first = $self->[0]. ':'. shift @lines; |
|
65
|
52
|
|
|
|
|
214
|
($first, @lines); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub unfoldedBody($;@) |
|
69
|
2858
|
|
|
2858
|
1
|
10343
|
{ my $self = shift; |
|
70
|
|
|
|
|
|
|
|
|
71
|
2858
|
100
|
|
|
|
7129
|
$self->[1] = $self->fold($self->[0], @_) |
|
72
|
|
|
|
|
|
|
if @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
2858
|
|
|
|
|
7801
|
$self->unfold($self->[1]); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub foldedBody($) |
|
78
|
219
|
|
|
219
|
1
|
453
|
{ my ($self, $body) = @_; |
|
79
|
219
|
100
|
|
|
|
468
|
if(@_==2) { $self->[1] = $body } |
|
|
4
|
|
|
|
|
11
|
|
|
80
|
215
|
|
|
|
|
495
|
else { $body = $self->[1] } |
|
81
|
|
|
|
|
|
|
|
|
82
|
219
|
100
|
|
|
|
752
|
wantarray ? (split m/^/, $body) : $body; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# For performance reasons only |
|
86
|
|
|
|
|
|
|
sub print(;$) |
|
87
|
131
|
|
|
131
|
1
|
516
|
{ my $self = shift; |
|
88
|
131
|
|
33
|
|
|
237
|
my $fh = shift || select; |
|
89
|
131
|
|
|
|
|
754
|
$fh->print($self->[0].':'.$self->[1]); |
|
90
|
131
|
|
|
|
|
1515
|
$self; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |