1Mail::Message::Convert:U:sHetrmlC(o3n)tributed Perl DocuMmaeinlt:a:tMieosnsage::Convert::Html(3)
2
3
4
6 Mail::Message::Convert::Html - Format messages in HTML
7
9 Mail::Message::Convert::Html
10 is a Mail::Message::Convert
11 is a Mail::Reporter
12
14 use Mail::Message::Convert::Html;
15 my $Html = Mail::Message::Convert::Html->new;
16
17 print $html->fieldToHtml($head);
18 print $html->headToHtmlHead($head);
19 print $html->headToHtmlTable($head);
20 print $html->textToHtml($text);
21
23 The package contains various translators which handle HTML or XHTML
24 without the help of external modules. There are more HTML related mod‐
25 ules, which do require extra packages to be installed.
26
28 Constructors
29
30 Mail::Message::Convert::Html->new(OPTIONS)
31
32 Option --Defined in --Default
33 fields Mail::Message::Convert <see description>
34 head_mailto <true>
35 log Mail::Reporter 'WARNINGS'
36 produce HTML
37 trace Mail::Reporter 'WARNINGS'
38
39 . fields NAMES⎪ARRAY-OF-NAMES⎪REGEXS
40
41 . head_mailto BOOLEAN
42
43 Whether to replace e-mail addresses in some header lines with
44 links.
45
46 . log LEVEL
47
48 . produce 'HTML'⎪'XHTML'
49
50 Produce HTML or XHTML output. The output is slightly differ‐
51 ent, even html browsers will usually accept the XHTML data.
52
53 . trace LEVEL
54
55 Converting
56
57 $obj->fieldContentsToHtml(FIELD, [SUBJECT])
58
59 Format one field from the header to HTML. When the header line
60 usually contains e-mail addresses, the line is scanned and valid
61 addresses are linked with an "mailto:" anchor. The SUBJECT can be
62 specified to be included in that link.
63
64 $obj->fieldToHtml(FIELD, [SUBJECT])
65
66 Reformat one header line field to HTML. The FIELD's name is
67 printed in bold, followed by the formatted field content, which is
68 produced by fieldContentsToHtml().
69
70 $obj->headToHtmlHead(HEAD, META)
71
72 Translate the selected header lines (fields) to an html page
73 header. Each selected field will get its own meta line with the
74 same name as the line. Furthermore, the "Subject" field will
75 become the "title", and "From" is used for the "Author".
76
77 Besides, you can specify your own meta fields, which will overrule
78 header fields. Empty fields will not be included. When a "title"
79 is specified, this will become the html title, otherwise the "Sub‐
80 ject" field is taken. In list context, the lines are separately,
81 where in scalar context the whole text is returned as one.
82
83 If you need to add lines to the head (for instance, http-equiv
84 lines), then splice them before the last element in the returned
85 list.
86
87 Example:
88
89 my @head = $html->headToHtmlHead
90 ( $head
91 , description => 'This is a message'
92 , generator => 'Mail::Box'
93 );
94 splice @head, -1, 0, '<meta http-equiv=...>';
95 print @head;
96
97 $obj->headToHtmlTable(HEAD, [TABLE-PARAMS])
98
99 Produce a display of the selectedFields() of the header in a table
100 shape. The optional TABLE-PARAMS are added as parameters to the
101 produced TABLE tag. In list context, the separate lines are
102 returned. In scalar context, everything is returned as one.
103
104 Example:
105
106 print $html->headToHtmlTable($head, 'width="50%"');
107
108 $obj->selectedFields(HEAD)
109
110 See "Converting" in Mail::Message::Convert
111
112 $obj->textToHtml(LINES)
113
114 Translate one or more LINES from text into HTML. Each line is
115 taken one after the other, and only simple things are translated.
116 "textToHtml" is able to convert large plain texts in a descent
117 fashion. In scalar context, the resulting lines are returned as
118 one.
119
120 Error handling
121
122 $obj->AUTOLOAD
123
124 See "Error handling" in Mail::Reporter
125
126 $obj->addReport(OBJECT)
127
128 See "Error handling" in Mail::Reporter
129
130 $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
131
132 Mail::Message::Convert::Html->defaultTrace([LEVEL]⎪[LOGLEVEL,
133 TRACELEVEL]⎪[LEVEL, CALLBACK])
134
135 See "Error handling" in Mail::Reporter
136
137 $obj->errors
138
139 See "Error handling" in Mail::Reporter
140
141 $obj->log([LEVEL [,STRINGS]])
142
143 Mail::Message::Convert::Html->log([LEVEL [,STRINGS]])
144
145 See "Error handling" in Mail::Reporter
146
147 $obj->logPriority(LEVEL)
148
149 Mail::Message::Convert::Html->logPriority(LEVEL)
150
151 See "Error handling" in Mail::Reporter
152
153 $obj->logSettings
154
155 See "Error handling" in Mail::Reporter
156
157 $obj->notImplemented
158
159 See "Error handling" in Mail::Reporter
160
161 $obj->report([LEVEL])
162
163 See "Error handling" in Mail::Reporter
164
165 $obj->reportAll([LEVEL])
166
167 See "Error handling" in Mail::Reporter
168
169 $obj->trace([LEVEL])
170
171 See "Error handling" in Mail::Reporter
172
173 $obj->warnings
174
175 See "Error handling" in Mail::Reporter
176
177 Cleanup
178
179 $obj->DESTROY
180
181 See "Cleanup" in Mail::Reporter
182
183 $obj->inGlobalDestruction
184
185 See "Cleanup" in Mail::Reporter
186
188 Error: Package $package does not implement $method.
189
190 Fatal error: the specific package (or one of its superclasses) does not
191 implement this method where it should. This message means that some
192 other related classes do implement this method however the class at
193 hand does not. Probably you should investigate this and probably
194 inform the author of the package.
195
197 This module is part of Mail-Box distribution version 2.070, built on
198 March 25, 2007. Website: http://perl.overmeer.net/mailbox/
199
201 Copyrights 2001-2007 by Mark Overmeer.For other contributors see
202 ChangeLog.
203
204 This program is free software; you can redistribute it and/or modify it
205 under the same terms as Perl itself. See
206 http://www.perl.com/perl/misc/Artistic.html
207
208
209
210perl v5.8.8 2007-03-25 Mail::Message::Convert::Html(3)