1Mail::Message::ConstrucUts:e:rTeCxotn(t3r)ibuted Perl DoMcauimle:n:tMaetsisoange::Construct::Text(3)
2
3
4
6 Mail::Message::Construct::Text - capture a Mail::Message as text
7
9 my $text = $msg->string;
10 my $text = "$msg"; # via overload
11
12 my @text = $msg->lines;
13 my @text = @$lines; # via overload
14
15 my $fh = $msg->file;
16 my $line = <$fh>;
17
18 $msg->printStructure;
19
21 Complex functionality on Mail::Message objects is implemented in
22 different files which are autoloaded. This file implements the
23 functionality related to creating message replies.
24
26 The whole message as text
27 $obj->file()
28 Returns the message as file-handle.
29
30 $obj->lines()
31 Returns the whole message as set of lines. In LIST context, copies
32 of the lines are returned. In SCALAR context, a reference to an
33 array of lines is returned.
34
35 $obj->printStructure( [$fh|undef],[$indent] )
36 Print the structure of a message to the specified $fh or the
37 selected filehandle. When explicitly "undef" is specified as
38 handle, then the output will be returned as string.
39
40 The message's subject and the types of all composing parts are
41 displayed.
42
43 $indent specifies the initial indentation string: it is added in
44 front of each line. The $indent must contain at least one white-
45 space.
46
47 example:
48
49 my $msg = ...;
50 $msg->printStructure(\*OUTPUT);
51
52 $msg->printStructure;
53
54 my $struct = $msg->printStructure(undef);
55
56 # Possible output for one message:
57 multipart/mixed: forwarded message from Pietje Puk (1550 bytes)
58 text/plain (164 bytes)
59 message/rfc822 (1043 bytes)
60 multipart/alternative: A multipart alternative (942 bytes)
61 text/plain (148 bytes, deleted)
62 text/html (358 bytes)
63
64 $obj->string()
65 Returns the whole message as string.
66
67 Flags
69 This module is part of Mail-Message distribution version 3.012, built
70 on February 11, 2022. Website: http://perl.overmeer.net/CPAN/
71
73 Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. For other
74 contributors see ChangeLog.
75
76 This program is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself. See http://dev.perl.org/licenses/
78
79
80
81perl v5.34.0 2022-03-01 Mail::Message::Construct::Text(3)