1Mail::Message::Replace:U:sMearilCHoenatdreirb(u3t)ed PerMlaiDlo:c:uMmeesnstaagtei:o:nReplace::MailHeader(3)
2
3
4

NAME

6       Mail::Message::Replace::MailHeader - fake Mail::Header
7

INHERITANCE

9        Mail::Message::Replace::MailHeader
10          is a Mail::Message::Head::Complete
11          is a Mail::Message::Head
12          is a Mail::Reporter
13

SYNOPSIS

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

DESCRIPTION

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

OVERLOADED

35       overload: ""
36
37           See "OVERLOADED" in Mail::Message::Head
38
39       overload: bool
40
41           See "OVERLOADED" in Mail::Message::Head
42

METHODS

44       Constructors
45
46       $obj->build([PAIR⎪FIELD]-LIST)
47
48           See "Constructors" in Mail::Message::Head::Complete
49
50       $obj->clone([NAMES⎪ARRAY-OF-NAMES⎪REGEXS])
51
52           See "Constructors" in Mail::Message::Head::Complete
53
54       Mail::Message::Replace::MailHeader->new([ARG], OPTIONS)
55
56           The ARG is an array with header lines.
57
58            Option    --Defined in     --Default
59            FoldLength                   79
60            MailFrom                     'KEEP'
61            Modify                       <false>
62            field_type  Mail::Message::Head  Mail::Message::Field::Fast
63            log         Mail::Reporter   'WARNINGS'
64            message     Mail::Message::Head  undef
65            modified    Mail::Message::Head  <false>
66            trace       Mail::Reporter   'WARNINGS'
67
68           . FoldLength INTEGER
69
70           . MailFrom 'IGNORE'⎪'ERROR'⎪'COERCE'⎪'KEEP'
71
72               How to handle the "From " lines.  See mail_from().
73
74           . Modify BOOLEAN
75
76               Reformat all header lines when they come in: change the fold‐
77               ing.
78
79           . field_type CLASS
80
81           . log LEVEL
82
83           . message MESSAGE
84
85           . modified BOOLEAN
86
87           . trace LEVEL
88
89       The header
90
91       $obj->isDelayed
92
93           See "The header" in Mail::Message::Head
94
95       $obj->isEmpty
96
97           See "The header" in Mail::Message::Head
98
99       $obj->isModified
100
101           See "The header" in Mail::Message::Head
102
103       $obj->knownNames
104
105           See "The header" in Mail::Message::Head
106
107       $obj->message([MESSAGE])
108
109           See "The header" in Mail::Message::Head
110
111       $obj->modified([BOOLEAN])
112
113           See "The header" in Mail::Message::Head
114
115       $obj->nrLines
116
117           See "The header" in Mail::Message::Head::Complete
118
119       $obj->orderedFields
120
121           See "The header" in Mail::Message::Head
122
123       $obj->size
124
125           See "The header" in Mail::Message::Head::Complete
126
127       $obj->wrap(INTEGER)
128
129           See "The header" in Mail::Message::Head::Complete
130
131       Access to the header
132
133       $obj->add(LINE, [INDEX])
134
135           Add a header line, which simply calls "Mail::Message::Head::add()"
136           on the header for the specified LINE.  The INDEX is ignored, the
137           unfolded body of the field is returned.
138
139       $obj->addListGroup(OBJECT)
140
141           See "Access to the header" in Mail::Message::Head::Complete
142
143       $obj->addResentGroup(RESENT-GROUP⎪DATA)
144
145           See "Access to the header" in Mail::Message::Head::Complete
146
147       $obj->addSpamGroup(OBJECT)
148
149           See "Access to the header" in Mail::Message::Head::Complete
150
151       $obj->count(NAME)
152
153           See "Access to the header" in Mail::Message::Head::Complete
154
155       $obj->delete(TAG, [INDEX])
156
157           Delete the fields with the specified TAG.  The deleted fields are
158           returned.  If no index is given, then all are removed.
159
160       $obj->get(NAME, [INDEX])
161
162           Get all the header fields with the specified NAME.  In scalar con‐
163           text, only the first fitting NAME is returned.  Even when only one
164           NAME is specified, multiple lines may be returned in list context:
165           some fields appear more than once in a header.
166
167       $obj->grepNames([NAMES⎪ARRAY-OF-NAMES⎪REGEXS])
168
169           See "Access to the header" in Mail::Message::Head::Complete
170
171       $obj->listGroup
172
173           See "Access to the header" in Mail::Message::Head::Complete
174
175       $obj->names
176
177           See "Access to the header" in Mail::Message::Head::Complete
178
179       $obj->print([FILEHANDLE])
180
181           See "Access to the header" in Mail::Message::Head::Complete
182
183       $obj->printSelected(FILEHANDLE, (STRING⎪REGEXP)s)
184
185           See "Access to the header" in Mail::Message::Head::Complete
186
187       $obj->printUndisclosed([FILEHANDLE])
188
189           See "Access to the header" in Mail::Message::Head::Complete
190
191       $obj->removeContentInfo
192
193           See "Access to the header" in Mail::Message::Head::Complete
194
195       $obj->removeField(FIELD)
196
197           See "Access to the header" in Mail::Message::Head::Complete
198
199       $obj->removeFields(STRING⎪REGEXP, [STRING⎪REGEXP, ...])
200
201           See "Access to the header" in Mail::Message::Head::Complete
202
203       $obj->removeFieldsExcept(STRING⎪REGEXP, [STRING⎪REGEXP, ...])
204
205           See "Access to the header" in Mail::Message::Head::Complete
206
207       $obj->removeListGroup
208
209           See "Access to the header" in Mail::Message::Head::Complete
210
211       $obj->removeResentGroups
212
213           See "Access to the header" in Mail::Message::Head::Complete
214
215       $obj->removeSpamGroups
216
217           See "Access to the header" in Mail::Message::Head::Complete
218
219       $obj->replace(TAG, LINE, [INDEX])
220
221           Replace the field named TAG. from place INDEX (by default the
222           first) by the LINE.  When TAG is "undef", it will be extracted from
223           the LINE first.  This calls Mail::Message::Head::Complete::reset()
224           on the message's head.
225
226       $obj->resentGroups
227
228           See "Access to the header" in Mail::Message::Head::Complete
229
230       $obj->reset(NAME, FIELDS)
231
232           See "Access to the header" in Mail::Message::Head::Complete
233
234       $obj->set(FIELD ⎪ LINE ⎪ (NAME, BODY [,ATTRS]))
235
236           See "Access to the header" in Mail::Message::Head::Complete
237
238       $obj->spamDetected
239
240           See "Access to the header" in Mail::Message::Head::Complete
241
242       $obj->spamGroups([NAMES])
243
244           See "Access to the header" in Mail::Message::Head::Complete
245
246       $obj->string
247
248           See "Access to the header" in Mail::Message::Head::Complete
249
250       $obj->study(NAME [,INDEX])
251
252           See "Access to the header" in Mail::Message::Head
253
254       About the body
255
256       $obj->guessBodySize
257
258           See "About the body" in Mail::Message::Head
259
260       $obj->guessTimeStamp
261
262           See "About the body" in Mail::Message::Head::Complete
263
264       $obj->isMultipart
265
266           See "About the body" in Mail::Message::Head
267
268       $obj->recvstamp
269
270           See "About the body" in Mail::Message::Head::Complete
271
272       $obj->timestamp
273
274           See "About the body" in Mail::Message::Head::Complete
275
276       Internals
277
278       $obj->addNoRealize(FIELD)
279
280           See "Internals" in Mail::Message::Head
281
282       $obj->addOrderedFields(FIELDS)
283
284           See "Internals" in Mail::Message::Head
285
286       $obj->createFromLine
287
288           See "Internals" in Mail::Message::Head::Complete
289
290       $obj->createMessageId
291
292           See "Internals" in Mail::Message::Head::Complete
293
294       $obj->fileLocation
295
296           See "Internals" in Mail::Message::Head
297
298       $obj->load
299
300           See "Internals" in Mail::Message::Head
301
302       $obj->messageIdPrefix([PREFIX, [HOSTNAME]⎪CODE])
303
304       Mail::Message::Replace::MailHeader->messageIdPrefix([PREFIX, [HOST‐
305       NAME]⎪CODE])
306
307           See "Internals" in Mail::Message::Head::Complete
308
309       $obj->moveLocation(DISTANCE)
310
311           See "Internals" in Mail::Message::Head
312
313       $obj->setNoRealize(FIELD)
314
315           See "Internals" in Mail::Message::Head
316
317       Error handling
318
319       $obj->AUTOLOAD
320
321           See "Error handling" in Mail::Reporter
322
323       $obj->addReport(OBJECT)
324
325           See "Error handling" in Mail::Reporter
326
327       $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
328
329       Mail::Message::Replace::MailHeader->defaultTrace([LEVEL]⎪[LOGLEVEL,
330       TRACELEVEL]⎪[LEVEL, CALLBACK])
331
332           See "Error handling" in Mail::Reporter
333
334       $obj->errors
335
336           See "Error handling" in Mail::Reporter
337
338       $obj->log([LEVEL [,STRINGS]])
339
340       Mail::Message::Replace::MailHeader->log([LEVEL [,STRINGS]])
341
342           See "Error handling" in Mail::Reporter
343
344       $obj->logPriority(LEVEL)
345
346       Mail::Message::Replace::MailHeader->logPriority(LEVEL)
347
348           See "Error handling" in Mail::Reporter
349
350       $obj->logSettings
351
352           See "Error handling" in Mail::Reporter
353
354       $obj->notImplemented
355
356           See "Error handling" in Mail::Reporter
357
358       $obj->report([LEVEL])
359
360           See "Error handling" in Mail::Reporter
361
362       $obj->reportAll([LEVEL])
363
364           See "Error handling" in Mail::Reporter
365
366       $obj->trace([LEVEL])
367
368           See "Error handling" in Mail::Reporter
369
370       $obj->warnings
371
372           See "Error handling" in Mail::Reporter
373
374       Cleanup
375
376       $obj->DESTROY
377
378           See "Cleanup" in Mail::Reporter
379
380       $obj->inGlobalDestruction
381
382           See "Cleanup" in Mail::Reporter
383
384       Access to the header
385
386       Simulating Mail::Header
387
388       $obj->as_string
389
390           Returns the whole header as one big scalar.  Calls Mail::Mes‐
391           sage::Head::Complete::string().
392
393       $obj->cleanup
394
395           Cleanup memory usage.  Not needed here.
396
397       $obj->combine(TAG, [WITH])
398
399           I do not see any valid reason for this command, so did not imple‐
400           ment it.
401
402       $obj->dup
403
404           Duplicate the header, which is simply clone().
405
406       $obj->empty
407
408           Clean-out the whole hash. Better not use this (simply create
409           another header object), although it should work.
410
411       $obj->exists
412
413           Returns whether there are any fields.
414
415       $obj->extract(ARRAY)
416
417           Extract (and remove) header fields from the array.
418
419       $obj->fold([LENGTH])
420
421           Refold all fields in the header, to LENGTH or whatever
422           fold_length() returns.
423
424       $obj->fold_length([[TAG], LENGTH])
425
426           Returns the line wrap, optionally after setting it to LENGTH.  The
427           old value is returned.  The TAG argument is ignored, because it is
428           silly to have different lines fold in different ways.  This method
429           cannot be called statically anymore.
430
431       $obj->header([ARRAY])
432
433           Extract the fields from the ARRAY, if specified, and then fold the
434           fields.  Returned is an array with all fields, produced via
435           orderedFields().
436
437       $obj->header_hashref(HASH)
438
439           If you are using this method, you must be stupid... anyway: I do
440           not want to support it for now: use add() and friends.
441
442       $obj->mail_from(['IGNORE'⎪'ERROR'⎪'COERCE'⎪'KEEP'])
443
444           What to do when a header line in the form `From ' is encountered.
445           Valid values are "IGNORE" - ignore and discard the header, "ERROR"
446           - invoke an error (call die), "COERCE" - rename them as Mail-From
447           and "KEEP" - keep them.
448
449       $obj->modify([BOOLEAN])
450
451           Refold the headers when they are added.
452
453       $obj->read(FILE)
454
455           Read the header from the FILE.
456
457       $obj->tags
458
459           Returns all the names of fields, implemented by Mail::Mes‐
460           sage::Head::Complete::names().
461
462       $obj->unfold([TAG])
463
464           Remove the folding for all instances of TAG, or all fields at once.
465
466       The nasty bits
467
468       $obj->isa(CLASS)
469
470       Mail::Message::Replace::MailHeader->isa(CLASS)
471
472           Of course, the "isa()" class inheritance check should not see our
473           nasty trick.
474

DETAILS

DIAGNOSTICS

477       Warning: Cannot remove field $name from header: not found.
478
479       You ask to remove a field which is not known in the header.  Using
480       delete(), reset(), or set() to do the job will not result in warnings:
481       those methods check the existence of the field first.
482
483       Warning: Field objects have an implied name ($name)
484
485       Error: Package $package does not implement $method.
486
487       Fatal error: the specific package (or one of its superclasses) does not
488       implement this method where it should. This message means that some
489       other related classes do implement this method however the class at
490       hand does not.  Probably you should investigate this and probably
491       inform the author of the package.
492

SEE ALSO

494       This module is part of Mail-Box distribution version 2.070, built on
495       March 25, 2007. Website: http://perl.overmeer.net/mailbox/
496

LICENSE

498       Copyrights 2001-2007 by Mark Overmeer.For other contributors see
499       ChangeLog.
500
501       This program is free software; you can redistribute it and/or modify it
502       under the same terms as Perl itself.  See
503       http://www.perl.com/perl/misc/Artistic.html
504
505
506
507perl v5.8.8                       2007-03-M2a5il::Message::Replace::MailHeader(3)
Impressum