| 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::Body::String; |
|
10
|
6
|
|
|
6
|
|
669
|
use vars '$VERSION'; |
|
|
6
|
|
|
|
|
17
|
|
|
|
6
|
|
|
|
|
392
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.013'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
46
|
use base 'Mail::Message::Body'; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
1852
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
6
|
|
|
6
|
|
56
|
use strict; |
|
|
6
|
|
|
|
|
15
|
|
|
|
6
|
|
|
|
|
150
|
|
|
16
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
170
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
6
|
|
|
6
|
|
45
|
use Carp; |
|
|
6
|
|
|
|
|
15
|
|
|
|
6
|
|
|
|
|
410
|
|
|
19
|
6
|
|
|
6
|
|
37
|
use Mail::Box::FastScalar; |
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
5160
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#------------------------------------------ |
|
23
|
|
|
|
|
|
|
# The scalar is stored as reference to avoid a copy during creation of |
|
24
|
|
|
|
|
|
|
# a string object. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _data_from_filename(@) |
|
27
|
0
|
|
|
0
|
|
0
|
{ my ($self, $filename) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
delete $self->{MMBS_nrlines}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
local *IN; |
|
32
|
0
|
0
|
|
|
|
0
|
unless(open IN, '<', $filename) |
|
33
|
0
|
|
|
|
|
0
|
{ $self->log(ERROR => |
|
34
|
|
|
|
|
|
|
"Unable to read file $filename for message body scalar: $!"); |
|
35
|
0
|
|
|
|
|
0
|
return; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
my @lines = ; |
|
39
|
0
|
|
|
|
|
0
|
close IN; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
$self->{MMBS_nrlines} = @lines; |
|
42
|
0
|
|
|
|
|
0
|
$self->{MMBS_scalar} = join '', @lines; |
|
43
|
0
|
|
|
|
|
0
|
$self; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _data_from_filehandle(@) |
|
47
|
1
|
|
|
1
|
|
4
|
{ my ($self, $fh) = @_; |
|
48
|
1
|
50
|
|
|
|
4
|
if(ref $fh eq 'Mail::Box::FastScalar') |
|
49
|
0
|
|
|
|
|
0
|
{ my $lines = $fh->getlines; |
|
50
|
0
|
|
|
|
|
0
|
$self->{MMBS_nrlines} = @$lines; |
|
51
|
0
|
|
|
|
|
0
|
$self->{MMBS_scalar} = join '', @$lines; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
else |
|
54
|
1
|
|
|
|
|
5
|
{ my @lines = $fh->getlines; |
|
55
|
1
|
|
|
|
|
297
|
$self->{MMBS_nrlines} = @lines; |
|
56
|
1
|
|
|
|
|
5
|
$self->{MMBS_scalar} = join '', @lines; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
1
|
|
|
|
|
6
|
$self; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _data_from_glob(@) |
|
62
|
0
|
|
|
0
|
|
0
|
{ my ($self, $fh) = @_; |
|
63
|
0
|
|
|
|
|
0
|
my @lines = <$fh>; |
|
64
|
0
|
|
|
|
|
0
|
$self->{MMBS_nrlines} = @lines; |
|
65
|
0
|
|
|
|
|
0
|
$self->{MMBS_scalar} = join '', @lines; |
|
66
|
0
|
|
|
|
|
0
|
$self; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _data_from_lines(@) |
|
70
|
1
|
|
|
1
|
|
5
|
{ my ($self, $lines) = @_; |
|
71
|
1
|
50
|
|
|
|
5
|
$self->{MMBS_nrlines} = @$lines unless @$lines==1; |
|
72
|
1
|
50
|
|
|
|
8
|
$self->{MMBS_scalar} = @$lines==1 ? shift @$lines : join('', @$lines); |
|
73
|
1
|
|
|
|
|
4
|
$self; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub clone() |
|
77
|
0
|
|
|
0
|
1
|
0
|
{ my $self = shift; |
|
78
|
0
|
|
|
|
|
0
|
ref($self)->new(data => $self->string, based_on => $self); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub nrLines() |
|
82
|
2
|
|
|
2
|
1
|
5
|
{ my $self = shift; |
|
83
|
2
|
50
|
|
|
|
16
|
return $self->{MMBS_nrlines} if defined $self->{MMBS_nrlines}; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
my $lines = $self->{MMBS_scalar} =~ tr/\n/\n/; |
|
86
|
0
|
0
|
|
|
|
0
|
$lines++ if $self->{MMBS_scalar} !~ m/\n\z/; |
|
87
|
0
|
|
|
|
|
0
|
$self->{MMBS_nrlines} = $lines; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
2
|
|
|
2
|
1
|
14
|
sub size() { length shift->{MMBS_scalar} } |
|
91
|
|
|
|
|
|
|
|
|
92
|
3
|
|
|
3
|
1
|
573
|
sub string() { shift->{MMBS_scalar} } |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub lines() |
|
95
|
3
|
|
|
3
|
1
|
584
|
{ my @lines = split /^/, shift->{MMBS_scalar}; |
|
96
|
3
|
100
|
|
|
|
19
|
wantarray ? @lines : \@lines; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
0
|
sub file() { Mail::Box::FastScalar->new(\shift->{MMBS_scalar}) } |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub print(;$) |
|
102
|
2
|
|
|
2
|
1
|
42
|
{ my $self = shift; |
|
103
|
2
|
|
33
|
|
|
10
|
my $fh = shift || select; |
|
104
|
2
|
50
|
|
|
|
20
|
if(ref $fh eq 'GLOB') { print $fh $self->{MMBS_scalar} } |
|
|
0
|
|
|
|
|
0
|
|
|
105
|
2
|
|
|
|
|
8
|
else { $fh->print($self->{MMBS_scalar}) } |
|
106
|
2
|
|
|
|
|
29
|
$self; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub read($$;$@) |
|
110
|
0
|
|
|
0
|
1
|
|
{ my ($self, $parser, $head, $bodytype) = splice @_, 0, 4; |
|
111
|
0
|
|
|
|
|
|
delete $self->{MMBS_nrlines}; |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
(my $begin, my $end, $self->{MMBS_scalar}) = $parser->bodyAsString(@_); |
|
114
|
0
|
|
|
|
|
|
$self->fileLocation($begin, $end); |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
$self; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
0
|
1
|
|
sub endsOnNewline() { shift->{MMBS_scalar} =~ m/\A\z|\n\z/ } |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |