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
34       Extends "DESCRIPTION" in Mail::Message::Head::Complete.
35

OVERLOADED

37       Extends "OVERLOADED" in Mail::Message::Head::Complete.
38
39       overload: ""
40           Inherited, see "OVERLOADED" in Mail::Message::Head
41
42       overload: bool
43           Inherited, see "OVERLOADED" in Mail::Message::Head
44

METHODS

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

DETAILS

407       Extends "DETAILS" in Mail::Message::Head::Complete.
408

DIAGNOSTICS

410       Warning: Cannot remove field $name from header: not found.
411           You ask to remove a field which is not known in the header.  Using
412           delete(), reset(), or set() to do the job will not result in
413           warnings: those methods check the existence of the field first.
414
415       Warning: Field objects have an implied name ($name)
416       Error: Package $package does not implement $method.
417           Fatal error: the specific package (or one of its superclasses) does
418           not implement this method where it should. This message means that
419           some other related classes do implement this method however the
420           class at hand does not.  Probably you should investigate this and
421           probably inform the author of the package.
422

SEE ALSO

424       This module is part of Mail-Message distribution version 3.012, built
425       on February 11, 2022. Website: http://perl.overmeer.net/CPAN/
426

LICENSE

428       Copyrights 2001-2022 by [Mark Overmeer <markov@cpan.org>]. For other
429       contributors see ChangeLog.
430
431       This program is free software; you can redistribute it and/or modify it
432       under the same terms as Perl itself.  See http://dev.perl.org/licenses/
433
434
435
436perl v5.36.0                      2022-07-M2a2il::Message::Replace::MailHeader(3)
Impressum