1Mail::Message::Replace:U:sMearilCHoenatdreirb(u3t)ed PerMlaiDlo:c:uMmeesnstaagtei:o:nReplace::MailHeader(3)
2
3
4
6 Mail::Message::Replace::MailHeader - fake Mail::Header
7
9 Mail::Message::Replace::MailHeader
10 is a Mail::Message::Head::Complete
11 is a Mail::Message::Head
12 is a Mail::Reporter
13
15 !!! ALPHA CODE !!!
16
17 # change
18 use Mail::Internet;
19 use Mail::Header;
20 # into
21 use Mail::Message::Replace::MailInternet;
22 # in existing code, and the code should still work, but
23 # with the Mail::Message features.
24
26 This module is a wrapper around a Mail::Message::Head::Complete, which
27 simulates a Mail::Header object. The name-space of that module is
28 hijacked and many methods are added.
29
30 Most methods will work without any change, but you should test your
31 software again. Small changes have been made to fold_length(),
32 header_hashref().
33
35 overload: ""
36 See "OVERLOADED" in Mail::Message::Head
37
38 overload: bool
39 See "OVERLOADED" in Mail::Message::Head
40
42 Constructors
43 $obj->build([PAIR|FIELD]-LIST)
44 See "Constructors" in Mail::Message::Head::Complete
45
46 $obj->clone([NAMES|ARRAY-OF-NAMES|REGEXS])
47 See "Constructors" in Mail::Message::Head::Complete
48
49 Mail::Message::Replace::MailHeader->new([ARG], OPTIONS)
50 The ARG is an array with header lines.
51
52 -Option --Defined in --Default
53 FoldLength 79
54 MailFrom 'KEEP'
55 Modify <false>
56 field_type Mail::Message::Head Mail::Message::Field::Fast
57 log Mail::Reporter 'WARNINGS'
58 message Mail::Message::Head undef
59 modified Mail::Message::Head <false>
60 trace Mail::Reporter 'WARNINGS'
61
62 FoldLength => INTEGER
63 MailFrom => 'IGNORE'|'ERROR'|'COERCE'|'KEEP'
64 How to handle the "From " lines. See mail_from().
65
66 Modify => BOOLEAN
67 Reformat all header lines when they come in: change the folding.
68
69 field_type => CLASS
70 log => LEVEL
71 message => MESSAGE
72 modified => BOOLEAN
73 trace => LEVEL
74
75 The header
76 $obj->isDelayed
77 See "The header" in Mail::Message::Head
78
79 $obj->isEmpty
80 See "The header" in Mail::Message::Head
81
82 $obj->isModified
83 See "The header" in Mail::Message::Head
84
85 $obj->knownNames
86 See "The header" in Mail::Message::Head
87
88 $obj->message([MESSAGE])
89 See "The header" in Mail::Message::Head
90
91 $obj->modified([BOOLEAN])
92 See "The header" in Mail::Message::Head
93
94 $obj->nrLines
95 See "The header" in Mail::Message::Head::Complete
96
97 $obj->orderedFields
98 See "The header" in Mail::Message::Head
99
100 $obj->size
101 See "The header" in Mail::Message::Head::Complete
102
103 $obj->wrap(INTEGER)
104 See "The header" in Mail::Message::Head::Complete
105
106 Access to the header
107 $obj->add(LINE, [INDEX])
108 Add a header line, which simply calls "Mail::Message::Head::add()"
109 on the header for the specified LINE. The INDEX is ignored, the
110 unfolded body of the field is returned.
111
112 $obj->addListGroup(OBJECT)
113 See "Access to the header" in Mail::Message::Head::Complete
114
115 $obj->addResentGroup(RESENT-GROUP|DATA)
116 See "Access to the header" in Mail::Message::Head::Complete
117
118 $obj->addSpamGroup(OBJECT)
119 See "Access to the header" in Mail::Message::Head::Complete
120
121 $obj->count(NAME)
122 See "Access to the header" in Mail::Message::Head::Complete
123
124 $obj->delete(TAG, [INDEX])
125 Delete the fields with the specified TAG. The deleted fields are
126 returned. If no index is given, then all are removed.
127
128 $obj->get(NAME, [INDEX])
129 Get all the header fields with the specified NAME. In scalar
130 context, only the first fitting NAME is returned. Even when only
131 one NAME is specified, multiple lines may be returned in list
132 context: some fields appear more than once in a header.
133
134 $obj->grepNames([NAMES|ARRAY-OF-NAMES|REGEXS])
135 See "Access to the header" in Mail::Message::Head::Complete
136
137 $obj->listGroup
138 See "Access to the header" in Mail::Message::Head::Complete
139
140 $obj->names
141 See "Access to the header" in Mail::Message::Head::Complete
142
143 $obj->print([FILEHANDLE])
144 See "Access to the header" in Mail::Message::Head::Complete
145
146 $obj->printSelected(FILEHANDLE, (STRING|REGEXP)s)
147 See "Access to the header" in Mail::Message::Head::Complete
148
149 $obj->printUndisclosed([FILEHANDLE])
150 See "Access to the header" in Mail::Message::Head::Complete
151
152 $obj->removeContentInfo
153 See "Access to the header" in Mail::Message::Head::Complete
154
155 $obj->removeField(FIELD)
156 See "Access to the header" in Mail::Message::Head::Complete
157
158 $obj->removeFields(STRING|REGEXP, [STRING|REGEXP, ...])
159 See "Access to the header" in Mail::Message::Head::Complete
160
161 $obj->removeFieldsExcept(STRING|REGEXP, [STRING|REGEXP, ...])
162 See "Access to the header" in Mail::Message::Head::Complete
163
164 $obj->removeListGroup
165 See "Access to the header" in Mail::Message::Head::Complete
166
167 $obj->removeResentGroups
168 See "Access to the header" in Mail::Message::Head::Complete
169
170 $obj->removeSpamGroups
171 See "Access to the header" in Mail::Message::Head::Complete
172
173 $obj->replace(TAG, LINE, [INDEX])
174 Replace the field named TAG. from place INDEX (by default the
175 first) by the LINE. When TAG is "undef", it will be extracted from
176 the LINE first. This calls Mail::Message::Head::Complete::reset()
177 on the message's head.
178
179 $obj->resentGroups
180 See "Access to the header" in Mail::Message::Head::Complete
181
182 $obj->reset(NAME, FIELDS)
183 See "Access to the header" in Mail::Message::Head::Complete
184
185 $obj->set(FIELD | LINE | (NAME, BODY [,ATTRS]))
186 See "Access to the header" in Mail::Message::Head::Complete
187
188 $obj->spamDetected
189 See "Access to the header" in Mail::Message::Head::Complete
190
191 $obj->spamGroups([NAMES])
192 See "Access to the header" in Mail::Message::Head::Complete
193
194 $obj->string
195 See "Access to the header" in Mail::Message::Head::Complete
196
197 $obj->study(NAME [,INDEX])
198 See "Access to the header" in Mail::Message::Head
199
200 About the body
201 $obj->guessBodySize
202 See "About the body" in Mail::Message::Head
203
204 $obj->guessTimeStamp
205 See "About the body" in Mail::Message::Head::Complete
206
207 $obj->isMultipart
208 See "About the body" in Mail::Message::Head
209
210 $obj->recvstamp
211 See "About the body" in Mail::Message::Head::Complete
212
213 $obj->timestamp
214 See "About the body" in Mail::Message::Head::Complete
215
216 Internals
217 $obj->addNoRealize(FIELD)
218 See "Internals" in Mail::Message::Head
219
220 $obj->addOrderedFields(FIELDS)
221 See "Internals" in Mail::Message::Head
222
223 $obj->createFromLine
224 See "Internals" in Mail::Message::Head::Complete
225
226 $obj->createMessageId
227 See "Internals" in Mail::Message::Head::Complete
228
229 $obj->fileLocation
230 See "Internals" in Mail::Message::Head
231
232 $obj->load
233 See "Internals" in Mail::Message::Head
234
235 $obj->messageIdPrefix([PREFIX, [HOSTNAME]|CODE])
236 Mail::Message::Replace::MailHeader->messageIdPrefix([PREFIX,
237 [HOSTNAME]|CODE])
238
239 See "Internals" in Mail::Message::Head::Complete
240
241 $obj->moveLocation(DISTANCE)
242 See "Internals" in Mail::Message::Head
243
244 $obj->setNoRealize(FIELD)
245 See "Internals" in Mail::Message::Head
246
247 Error handling
248 $obj->AUTOLOAD
249 See "Error handling" in Mail::Reporter
250
251 $obj->addReport(OBJECT)
252 See "Error handling" in Mail::Reporter
253
254 $obj->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])
255 Mail::Message::Replace::MailHeader->defaultTrace([LEVEL]|[LOGLEVEL,
256 TRACELEVEL]|[LEVEL, CALLBACK])
257
258 See "Error handling" in Mail::Reporter
259
260 $obj->errors
261 See "Error handling" in Mail::Reporter
262
263 $obj->log([LEVEL [,STRINGS]])
264 Mail::Message::Replace::MailHeader->log([LEVEL [,STRINGS]])
265
266 See "Error handling" in Mail::Reporter
267
268 $obj->logPriority(LEVEL)
269 Mail::Message::Replace::MailHeader->logPriority(LEVEL)
270
271 See "Error handling" in Mail::Reporter
272
273 $obj->logSettings
274 See "Error handling" in Mail::Reporter
275
276 $obj->notImplemented
277 See "Error handling" in Mail::Reporter
278
279 $obj->report([LEVEL])
280 See "Error handling" in Mail::Reporter
281
282 $obj->reportAll([LEVEL])
283 See "Error handling" in Mail::Reporter
284
285 $obj->trace([LEVEL])
286 See "Error handling" in Mail::Reporter
287
288 $obj->warnings
289 See "Error handling" in Mail::Reporter
290
291 Cleanup
292 $obj->DESTROY
293 See "Cleanup" in Mail::Reporter
294
295 $obj->inGlobalDestruction
296 See "Cleanup" in Mail::Reporter
297
298 Access to the header
299 Simulating Mail::Header
300 $obj->as_string
301 Returns the whole header as one big scalar. Calls
302 Mail::Message::Head::Complete::string().
303
304 $obj->cleanup
305 Cleanup memory usage. Not needed here.
306
307 $obj->combine(TAG, [WITH])
308 I do not see any valid reason for this command, so did not
309 implement it.
310
311 $obj->dup
312 Duplicate the header, which is simply clone().
313
314 $obj->empty
315 Clean-out the whole hash. Better not use this (simply create
316 another header object), although it should work.
317
318 $obj->exists
319 Returns whether there are any fields.
320
321 $obj->extract(ARRAY)
322 Extract (and remove) header fields from the array.
323
324 $obj->fold([LENGTH])
325 Refold all fields in the header, to LENGTH or whatever
326 fold_length() returns.
327
328 $obj->fold_length([[TAG], LENGTH])
329 Returns the line wrap, optionally after setting it to LENGTH. The
330 old value is returned. The TAG argument is ignored, because it is
331 silly to have different lines fold in different ways. This method
332 cannot be called statically anymore.
333
334 $obj->header([ARRAY])
335 Extract the fields from the ARRAY, if specified, and then fold the
336 fields. Returned is an array with all fields, produced via
337 orderedFields().
338
339 $obj->header_hashref(HASH)
340 If you are using this method, you must be stupid... anyway: I do
341 not want to support it for now: use add() and friends.
342
343 $obj->mail_from(['IGNORE'|'ERROR'|'COERCE'|'KEEP'])
344 What to do when a header line in the form `From ' is encountered.
345 Valid values are "IGNORE" - ignore and discard the header, "ERROR"
346 - invoke an error (call die), "COERCE" - rename them as Mail-From
347 and "KEEP" - keep them.
348
349 $obj->modify([BOOLEAN])
350 Refold the headers when they are added.
351
352 $obj->read(FILE)
353 Read the header from the FILE.
354
355 $obj->tags
356 Returns all the names of fields, implemented by
357 Mail::Message::Head::Complete::names().
358
359 $obj->unfold([TAG])
360 Remove the folding for all instances of TAG, or all fields at once.
361
362 The nasty bits
363 $obj->isa(CLASS)
364 Mail::Message::Replace::MailHeader->isa(CLASS)
365
366 Of course, the "isa()" class inheritance check should not see our
367 nasty trick.
368
370 Warning: Cannot remove field $name from header: not found.
371 You ask to remove a field which is not known in the header. Using
372 delete(), reset(), or set() to do the job will not result in
373 warnings: those methods check the existence of the field first.
374
375 Warning: Field objects have an implied name ($name)
376 Error: Package $package does not implement $method.
377 Fatal error: the specific package (or one of its superclasses) does
378 not implement this method where it should. This message means that
379 some other related classes do implement this method however the
380 class at hand does not. Probably you should investigate this and
381 probably inform the author of the package.
382
384 This module is part of Mail-Box distribution version 2.097, built on
385 January 26, 2011. Website: http://perl.overmeer.net/mailbox/
386
388 Copyrights 2001-2011 by Mark Overmeer. For other contributors see
389 ChangeLog.
390
391 This program is free software; you can redistribute it and/or modify it
392 under the same terms as Perl itself. See
393 http://www.perl.com/perl/misc/Artistic.html
394
395
396
397perl v5.12.3 2011-01-M2a6il::Message::Replace::MailHeader(3)