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