1Mail::Message::Field(3)User Contributed Perl DocumentatioMnail::Message::Field(3)
2
3
4

NAME

6       Mail::Message::Field - one line of a message header
7

INHERITANCE

9        Mail::Message::Field
10          is a Mail::Reporter
11
12        Mail::Message::Field is extended by
13          Mail::Message::Field::Fast
14          Mail::Message::Field::Flex
15          Mail::Message::Field::Full
16

SYNOPSIS

18        my $field = Mail::Message::Field->new(From => 'fish@tux.aq');
19        print $field->name;
20        print $field->body;
21        print $field->comment;
22        print $field->content;  # body & comment
23        $field->print(\*OUT);
24        print $field->string;
25        print "$field\n";
26        print $field->attribute('charset') ⎪⎪ 'us-ascii';
27

DESCRIPTION

29       This implementation follows the guidelines of rfc2822 as close as pos‐
30       sible, and may there produce a different output than implementations
31       based on the obsolete rfc822.  However, the old output will still be
32       accepted.
33
34       These objects each store one header line, and facilitates access rou‐
35       tines to the information hidden in it.  Also, you may want to have a
36       look at the added methods of a message:
37
38        my @from    = $message->from;
39        my $sender  = $message->sender;
40        my $subject = $message->subject;
41        my $msgid   = $message->messageId;
42
43        my @to      = $message->to;
44        my @cc      = $message->cc;
45        my @bcc     = $message->bcc;
46        my @dest    = $message->destinations;
47
48        my $other   = $message->get('Reply-To');
49

OVERLOADED

51       overload: ""
52
53           (stringification) produces the unfolded body of the field, which
54           may be what you expect.  This is what makes what the field object
55           seems to be a simple string. The string is produced by unfolded‐
56           Body().
57
58           Example:
59
60            print $msg->get('subject');  # via overloading
61            print $msg->get('subject')->unfoldedBody; # same
62
63            my $subject = $msg->get('subject') ⎪⎪ 'your mail';
64            print "Re: $subject\n";
65
66       overload: +0
67
68           (numification) When the field is numeric, the value will be
69           returned.  The result is produced by toInt().  If the value is not
70           correct, a 0 is produced, to simplify calculations.
71
72       overload: <=>
73
74           (numeric comparison) Compare the integer field contents with some‐
75           thing else.
76
77           Example:
78
79            if($msg->get('Content-Length') > 10000) ...
80            if($msg->size > 10000) ... ; # same, but better
81
82       overload: bool
83
84           Always true, to make it possible to say "if($field)".
85
86       overload: cmp
87
88           (string comparison) Compare the unfolded body of a field with an
89           other field or a string, using the buildin "cmp".
90

METHODS

92       Constructors
93
94       $obj->clone
95
96           Create a copy of this field object.
97
98       Mail::Message::Field->new(DATA)
99
100           See Mail::Message::Field::Fast::new(), Mail::Mes‐
101           sage::Field::Flex::new(), and Mail::Message::Field::Full::new().
102           By default, a "Fast" field is produced.
103
104            Option--Defined in     --Default
105            log     Mail::Reporter   'WARNINGS'
106            trace   Mail::Reporter   'WARNINGS'
107
108           . log LEVEL
109
110           . trace LEVEL
111
112       The field
113
114       $obj->isStructured
115
116       Mail::Message::Field->isStructured
117
118           Some fields are described in the RFCs as being structured: having a
119           well described syntax.  These fields have common ideas about com‐
120           ments and the like, what they do not share with unstructured
121           fields, like the "Subject" field.
122
123           Example:
124
125            my $field = Mail::Message::Field->new(From => 'me');
126            if($field->isStructured)
127
128            Mail::Message::Field->isStructured('From');
129
130       $obj->length
131
132           Returns the total length of the field in characters, which includes
133           the field's name, body and folding characters.
134
135       $obj->nrLines
136
137           Returns the number of lines needed to display this header-line.
138
139       $obj->print([FILEHANDLE])
140
141           Print the whole header-line to the specified file-handle. One line
142           may result in more than one printed line, because of the folding of
143           long lines.  The FILEHANDLE defaults to the selected handle.
144
145       $obj->size
146
147           Returns the number of bytes needed to display this header-line,
148           Same as length().
149
150       $obj->string([WRAP])
151
152           Returns the field as string.  By default, this returns the same as
153           folded(). However, the optional WRAP will cause to re-fold to take
154           place (without changing the folding stored inside the field).
155
156       $obj->toDisclose
157
158           Returns whether this field can be disclosed to other people, for
159           instance when sending the message to an other party.  Returns a
160           "true" or "false" condition.  See also Mail::Message::Head::Com‐
161           plete::printUndisclosed().
162
163       Access to the name
164
165       $obj->Name
166
167           Returns the name of this field in original casing.  See name() as
168           well.
169
170       $obj->name
171
172           Returns the name of this field, with all characters lower-cased for
173           ease of comparison.  See Name() as well.
174
175       $obj->wellformedName([STRING])
176
177           (Instance method class method) As instance method, the current
178           field's name is correctly formatted and returned.  When a STRING is
179           used, that one is formatted.
180
181           Example:
182
183            print Mail::Message::Field->Name('content-type')
184              # -->  Content-Type
185
186            my $field = $head->get('date');
187            print $field->Name;
188              # -->  Date
189
190       Access to the body
191
192       $obj->body
193
194           This method may be what you want, but usually, the foldedBody() and
195           unfoldedBody() are what you are looking for.  This method is cul‐
196           tural heritage, and should be avoided.
197
198           Returns the body of the field.  When this field is structured, it
199           will be stripped from everything what is behind the first semi-
200           color (";").  In any case, the string is unfolded.  Whether the
201           field is structured is defined by isStructured().
202
203       $obj->folded
204
205           Returns the folded version of the whole header.  When the header is
206           shorter than the wrap length, a list of one line is returned.  Oth‐
207           erwise more lines will be returned, all but the first starting with
208           at least one blank.  See also foldedBody() to get the same informa‐
209           tion without the field's name.
210
211           In scalar context, the lines are delived into one string, which is
212           a little faster because that's the way they are stored inter‐
213           nally...
214
215           Example:
216
217            my @lines = $field->folded;
218            print $field->folded;
219            print scalar $field->folded; # faster
220
221       $obj->foldedBody([BODY])
222
223           Returns the body as a set of lines. In scalar context, this will be
224           one line containing newlines.  Be warned about the newlines when
225           you do pattern-matching on the result of thie method.
226
227           The optional BODY argument changes the field's body.  The folding
228           of the argument must be correct.
229
230       $obj->stripCFWS([STRING])
231
232       Mail::Message::Field->stripCFWS([STRING])
233
234           Remove the comments and folding white spaces from the STRING.
235           Without string and only as instance method, the unfoldedBody() is
236           being stripped and returned.
237
238           WARNING: This operation is only allowed for structured header
239           fields (which are defined by the various RFCs as being so.  You
240           don't want parts within braces which are in the Subject header line
241           to be removed, to give an example.
242
243       $obj->unfoldedBody([BODY, [WRAP]])
244
245           Returns the body as one single line, where all folding information
246           (if available) is removed.  This line will also NOT end on a
247           new-line.
248
249           The optional BODY argument changes the field's body.  The right
250           folding is performed before assignment.  The WRAP may be specified
251           to enforce a folding size.
252
253           Example:
254
255            my $body = $field->unfoldedBody;
256            print "$field";   # via overloading
257
258       Access to the content
259
260       $obj->addresses
261
262           Returns a list of Mail::Address objects, which represent the e-mail
263           addresses found in this header line.
264
265           Example:
266
267            my @addr = $message->head->get('to')->addresses;
268            my @addr = $message->to;
269
270       $obj->attribute(NAME [, VALUE])
271
272           Get the value of an attribute, optionally after setting it to a new
273           value.  Attributes are part of some header lines, and hide them‐
274           selves in the comment field.  If the attribute does not exist, then
275           "undef" is returned.  The attribute is still encoded.
276
277           Example:
278
279            my $field = Mail::Message::Field->new(
280             'Content-Type: text/plain; charset="us-ascii"');
281
282            print $field->attribute('charset');
283              # --> us-ascii
284
285            print $field->attribute('bitmap') ⎪⎪ 'no'
286              # --> no
287
288            $field->atrribute(filename => '/tmp/xyz');
289            $field->print;
290              # --> Content-Type: text/plain; charset="us-ascii";
291              #       filename="/tmp/xyz"
292              # Automatically folded, and no doubles created.
293
294       $obj->attributes
295
296           Returns a list of key-value pairs, where the values are not yet
297           decoded.
298
299           Example:
300
301            my %attributes = $head->get('Content-Disposition')->attributes;
302
303       $obj->comment([STRING])
304
305           Returns the unfolded comment (part after a semi-colon) in a struc‐
306           tureed header-line. optionally after setting it to a new STRING
307           first.  When "undef" is specified as STRING, the comment is
308           removed.  Whether the field is structured is defined by isStruc‐
309           tured().
310
311           The comment part of a header field often contains "attributes".
312           Often it is preferred to use attribute() on them.
313
314       $obj->study
315
316           Study the header field in detail: turn on the full parsing and
317           detailed understanding of the content of the fields.  Mail::Mes‐
318           sage::Field::Fast and Mail::Message::Field::Fast objects will be
319           transformed into any Mail::Message::Field::Full object.
320
321           Example:
322
323            my $subject = $msg->head->get('subject')->study;
324            my $subject = $msg->head->study('subject');  # same
325            my $subject = $msg->study('subject');        # same
326
327       $obj->toDate([TIME])
328
329       Mail::Message::Field->toDate([TIME])
330
331           Convert a timestamp into an rfc2822 compliant date format.  This
332           differs from the default output of "localtime" in scalar context.
333           Without argument, the "localtime" is used to get the current time.
334           TIME can be specified as one numeric (like the result of "time()")
335           and as list (like produced by c<localtime()> in list context).
336
337           Be sure to have your timezone set right, especially when this
338           script runs automatically.
339
340           Example:
341
342            my $now = time;
343            Mail::Message::Field->toDate($now);
344            Mail::Message::Field->toDate(time);
345
346            Mail::Message::Field->toDate(localtime);
347            Mail::Message::Field->toDate;      # same
348            # returns someting like:
349            #     Wed, 28 Aug 2002 10:40:25 +0200
350
351       $obj->toInt
352
353           Returns the value which is related to this field as integer.  A
354           check is performed whether this is right.
355
356       Other methods
357
358       $obj->dateToTimestamp(STRING)
359
360       Mail::Message::Field->dateToTimestamp(STRING)
361
362           Convert a STRING which represents and RFC compliant time string
363           into a timestamp like is produced by the "time" function.
364
365       Internals
366
367       $obj->consume(LINE ⎪ (NAME,BODY⎪OBJECTS))
368
369           Accepts a whole field LINE, or a pair with the field's NAME and
370           BODY. In the latter case, the BODY data may be specified as array
371           of OBJECTS which are stringified.  Returned is a nicely formatted
372           pair of two strings: the field's name and a folded body.
373
374           This method is called by new(), and usually not by an application
375           program. The details about converting the OBJECTS to a field con‐
376           tent are explained in "Specifying field data".
377
378       $obj->defaultWrapLength([LENGTH])
379
380           Any field from any header for any message will have this default
381           wrapping.  This is maintained in one global variable.  Without a
382           specified LENGTH, the current value is returned.  The default is
383           78.
384
385       $obj->fold(NAME, BODY, [MAXCHARS])
386
387       Mail::Message::Field->fold(NAME, BODY, [MAXCHARS])
388
389           Make the header field with NAME fold into multiple lines.  Wrapping
390           is performed by inserting newlines before a blanks in the BODY,
391           such that no line exceeds the MAXCHARS and each line is as long as
392           possible.
393
394           The RFC requests for folding on nice spots, but this request is
395           mainly ignored because it would make folding too slow.
396
397       $obj->setWrapLength([LENGTH])
398
399           Force the wrapping of this field to the specified LENGTH charac‐
400           ters. The wrapping is performed with fold() and the results stored
401           within the field object.
402
403           Example: refolding the field
404
405            $field->setWrapLength(99);
406
407       $obj->stringifyData(STRING⎪ARRAY⎪OBJECTS)
408
409           This method implements the translation of user supplied objects
410           into ascii fields.  The process is explained in "Specifying field
411           data".
412
413       $obj->unfold(STRING)
414
415           The reverse action of fold(): all lines which form the body of a
416           field are joined into one by removing all line terminators (even
417           the last).  Possible leading blanks on the first line are removed
418           as well.
419
420       Error handling
421
422       $obj->AUTOLOAD
423
424           See "Error handling" in Mail::Reporter
425
426       $obj->addReport(OBJECT)
427
428           See "Error handling" in Mail::Reporter
429
430       $obj->defaultTrace([LEVEL]⎪[LOGLEVEL, TRACELEVEL]⎪[LEVEL, CALLBACK])
431
432       Mail::Message::Field->defaultTrace([LEVEL]⎪[LOGLEVEL,
433       TRACELEVEL]⎪[LEVEL, CALLBACK])
434
435           See "Error handling" in Mail::Reporter
436
437       $obj->errors
438
439           See "Error handling" in Mail::Reporter
440
441       $obj->log([LEVEL [,STRINGS]])
442
443       Mail::Message::Field->log([LEVEL [,STRINGS]])
444
445           See "Error handling" in Mail::Reporter
446
447       $obj->logPriority(LEVEL)
448
449       Mail::Message::Field->logPriority(LEVEL)
450
451           See "Error handling" in Mail::Reporter
452
453       $obj->logSettings
454
455           See "Error handling" in Mail::Reporter
456
457       $obj->notImplemented
458
459           See "Error handling" in Mail::Reporter
460
461       $obj->report([LEVEL])
462
463           See "Error handling" in Mail::Reporter
464
465       $obj->reportAll([LEVEL])
466
467           See "Error handling" in Mail::Reporter
468
469       $obj->trace([LEVEL])
470
471           See "Error handling" in Mail::Reporter
472
473       $obj->warnings
474
475           See "Error handling" in Mail::Reporter
476
477       Cleanup
478
479       $obj->DESTROY
480
481           See "Cleanup" in Mail::Reporter
482
483       $obj->inGlobalDestruction
484
485           See "Cleanup" in Mail::Reporter
486

DETAILS

488       Field syntax
489
490       Fields are stored in the header of a message, which are represented by
491       Mail::Message::Head objects. A field is a combination of a name, body,
492       and attributes.  Especially the term "body" is cause for confusion:
493       sometimes the attributes are considered to be part of the body.
494
495       The name of the field is followed by a colon ("":"", not preceeded by
496       blanks, but followed by one blank).  Each attribute is preceeded by a
497       separate semi-colon ("";"").  Names of fields are case-insensitive and
498       cannot contain blanks.
499
500       Example: of fields
501
502       Correct fields:
503
504        Field: hi!
505        Content-Type: text/html; charset=latin1
506
507       Incorrect fields, but accepted:
508
509        Field : wrong, blank before colon
510        Field:                 # wrong, empty
511        Field:not nice, blank preferred after colon
512        One Two: wrong, blank in name
513
514       Folding fields
515
516       Fields which are long can be folded to span more than one line.  The
517       real limit for lines in messages is only at 998 characters, however
518       such long lines are not easy to read without support of an application.
519       Therefore rfc2822 (which defines the message syntax) specifies explic‐
520       itly that field lines can be re-formatted into multiple sorter lines
521       without change of meaning, by adding new-line characters to any field
522       before any blank or tab.
523
524       Usually, the lines are reformatted to create lines which are 78 charac‐
525       ters maximum. Some applications try harder to fold on nice spots, like
526       before attributes.  Especially the "Received" field is often manually
527       folded into some nice layout.  In most cases however, it is preferred
528       to produce lines which are as long as possible but max 78.
529
530       BE WARNED that all fields can be subjected to folding, and that you
531       usually want the unfolded value.
532
533       Example: of field folding
534
535        Subject: this is a short line, and not folded
536
537        Subject: this subject field is much longer, and therefore
538         folded into multiple
539         lines, although one more than needed.
540
541       Structured fields
542
543       The rfc2822 describes a large number of header fields explicitly.
544       These fields have a defined meaning.  For some of the fields, like the
545       "Subject" field, the meaning is straight forward the contents itself.
546       These fields are the Unstructured Fields.
547
548       Other fields have a well defined internal syntax because their content
549       is needed by e-mail applications. For instance, the "To" field contains
550       addresses which must be understood by all applications in the same way.
551       These are the Structured Fields, see isStructured().
552
553       Comments in fields
554
555       Stuctured fields can contain comments, which are pieces of text
556       enclosed in parenthesis.  These comments can be placed close to any‐
557       where in the line and must be ignored be the application.  Not all
558       applications are capable of handling comments correctly in all circum‐
559       stances.
560
561       Example: of field comments
562
563        To: mailbox (Mail::Box mailinglist) <mailbox@overmeer.net>
564        Date: Thu, 13 Sep 2001 09:40:48 +0200 (CEST)
565        Subject: goodbye (was: hi!)
566
567       On the first line, the text "Mail::Box mailinglist" is used as comment.
568       Be warned that rfc2822 explicitly states that comments in e-mail
569       address specifications should not be considered to contain any usable
570       information.
571
572       On the second line, the timezone is specified as comment. The "Date"
573       field format has no way to indicate the timezone of the sender, but
574       only contains the timezone difference to UTC, however one could decide
575       to add this as comment.  Application must ignore this data because the
576       "Date" field is structured.
577
578       The last field is unstructured.  The text between parantheses is an
579       integral part of the subject line.
580
581       Getting a field
582
583       As many programs as there are handling e-mail, as many variations on
584       accessing the header information are requested.  Be careful which way
585       you access the data: read the variations described here and decide
586       which solution suites your needs best.
587
588       Using get() field
589
590       The "get()" interface is copied from other Perl modules which can han‐
591       dle e-mail messages.  Many applications which simply replace
592       Mail::Internet objects by Mail::Message objects will work without modi‐
593       fication.
594
595       There is more than one get method.  The exact results depend on which
596       get you use.  When Mail::Message::get() is called, you will get the
597       unfolded, stripped from comments, stripped from attributes contents of
598       the field as string.  Character-set encodings will still be in the
599       string.  If the same fieldname appears more than once in the header,
600       only the last value is returned.
601
602       When Mail::Message::Head::get() is called in scalar context, the last
603       field with the specified name is returned as field object.  This object
604       strinigfies into the unfolded contents of the field, including
605       attributes and comments.  In list context, all appearances of the field
606       in the header are returned as objects.
607
608       BE WARNED that some lines seem unique, but are not according to the
609       official rfc.  For instance, "To" fields can appear more than once.  If
610       your program calls "get('to')" in scalar context, some information is
611       lost.
612
613       Example: of using get()
614
615        print $msg->get('subject') ⎪⎪ 'no subject';
616        print $msg->head->get('subject') ⎪⎪ 'no subject';
617
618        my @to = $msg->head->get('to');
619
620       Using study() field
621
622       As the name "study" already implies, this way of accessing the fields
623       is much more thorough but also slower.  The "study" of a field is like
624       a "get", but provides easy access to the content of the field and han‐
625       dles character-set decoding correctly.
626
627       The Mail::Message::study() method will only return the last field with
628       that name as object.  Mail::Message::Head::study() and Mail::Mes‐
629       sage::Field::study() return all fields when used in list context.
630
631       Example: of using study()
632
633        print $msg->study('subject') ⎪⎪ 'no subject';
634        my @rec  = $msg->head->study('Received');
635
636        my $from = $msg->head->get('From')->study;
637        my $from = $msg->head->study('From');  # same
638        my @addr = $from->addresses;
639
640       Using resent groups
641
642       Some fields belong together in a group of fields.  For instance, a set
643       of lines is used to define one step in the mail transport process.
644       Each step adds a "Received" line, and optionally some "Resent-*" lines
645       and "Return-Path".  These groups of lines shall stay together and in
646       order when the message header is processed.
647
648       The "Mail::Message::Head::ResentGroup" object simplifies the access to
649       these related fields.  These resent groups can be deleted as a whole,
650       or correctly constructed.
651
652       Example: of using resent groups
653
654        my $rgs = $msg->head->resentGroups;
655        $rgs[0]->delete if @rgs;
656
657        $msg->head->removeResentGroups;
658
659       The field's data
660
661       There are many ways to get the fields info as object, and there are
662       also many ways to process this data within the field.
663
664       Access to the field
665
666       * string()
667           Returns the text of the body exactly as will be printed to file
668           when print() is called, so name, main body, and attributes.
669
670       * foldedBody()
671           Returns the text of the body, like string(), but without the name
672           of the field.
673
674       * unfoldedBody()
675           Returns the text of the body, like foldedBody(), but then with all
676           new-lines removed.  This is the normal way to get the content of
677           unstructured fields.  Character-set encodings will still be in
678           place.  Fields are stringified into their unfolded representation.
679
680       * stripCFWS()
681           Returns the text of structured fields, where new-lines and comments
682           are removed from the string.  This is a good start for parsing the
683           field, for instance to find e-mail addresses in them.
684
685       * Mail::Message::Field::Full::decodedBody()
686           Studied fields can produce the unfolded text decoded into utf8
687           strings.  This is an expensive process, but the only correct way to
688           get the field's data.  More useful for people who are not living in
689           ASCII space.
690
691       * Studied fields
692           Studied fields have powerful methods to provide ways to access and
693           produce the contents of (structured) fields exactly as the involved
694           rfcs prescribe.
695
696       Using simplified field access
697
698       Some fields are accessed that often that there are support methods to
699       provide simplified access.  All these methods are called upon a message
700       directly.
701
702       Example: of simplified field access
703
704        print $message->subject;
705        print $message->get('subject') ⎪⎪ '';  # same
706
707        my @from = $message->from; # returns addresses
708        $message->reply->send if $message->sender;
709
710       The "sender" method will return the address specified in the "Sender"
711       field, or the first named in the "From" field.  It will return "undef"
712       in case no address is known.
713
714       Specifying field data
715
716       Field data can be anything, strongly dependent on the type of field at
717       hand. If you decide to contruct the fields very carefully via some
718       Mail::Message::Field::Full extension (like via Mail::Mes‐
719       sage::Field::Addresses objects), then you will have protection
720       build-in.  However, you can bluntly create any Mail::Message::Field
721       object based on some data.
722
723       When you create a field, you may specify a string, object, or an array
724       of strings and objects.  On the moment, objects are only used to help
725       the construction on e-mail addresses, however you may add some of your
726       own.
727
728       The following rules (implemented in stringifyData()) are obeyed given
729       the argument is:
730
731       * a string
732           The string must be following the (complicated) rules of the
733           rfc2822, and is made field content as specified.  When the string
734           is not terminated by a new-line ("\n") it will be folded according
735           to the standard rules.
736
737       * a Mail::Address object
738           The most used Perl object to parse and produce address lines.  This
739           object does not understand character set encodings in phrases.
740
741       * a Mail::Identity object
742           As part of the User::Identity distribution, this object has full
743           understanding of the meaning of one e-mail address, related to a
744           person.  All features defined by rfc2822 are implemented.
745
746       * a User::Identity object
747           A person is specified, which may have more than one Mail::Iden‐
748           tity's defined.  Some methods, like Mail::Message::reply() and
749           Mail::Message::forward() try to select the right e-mail address
750           smart (see their method descriptions), but in other cases the first
751           e-mail address found is used.
752
753       * a User::Identity::Collection::Emails object
754           All Mail::Identity objects in the collection will be included in
755           the field as a group carying the name of the collection.
756
757       * any other object
758           For all other objects, the stringification overload is used to pro‐
759           duce the field content.
760
761       * an ARRAY
762           You may also specify an array with a mixture of any of the above.
763           The elements will be joined as comma-separated list.  If you do not
764           want comma's inbetween, you will have to process the array your‐
765           self.
766
767       Example: specifying simple field data
768
769        my $f = Mail::Message::Field->new(Subject => 'hi!');
770        my $b = Mail::Message->build(Subject => 'monkey');
771
772       Example: s specifying e-mail addresses for a field
773
774        use Mail::Address;
775        my $fish = Mail::Address->new('Mail::Box', 'fish@tux.aq');
776        print $fish->format;   # ==> Mail::Box <fish@tux.aq>
777        my $exa  = Mail::Address->new(undef, 'me@example.com');
778        print $exa->format;    # ==> me@example.com
779
780        my $b = $msg->build(To => "you@example.com");
781        my $b = $msg->build(To => $fish);
782        my $b = $msg->build(To => [ $fish, $exa ]);
783
784        my @all = ($fish, "you@example.com", $exa);
785        my $b = $msg->build(To => \@all);
786        my $b = $msg->build(To => [ "xyz", @all ]);
787
788       Example: specifying identities for a field
789
790        use User::Identity;
791        my $patrik = User::Identity->new
792         ( name      => 'patrik'
793         , full_name => "Patrik Fältström"  # from rfc
794         , charset   => "ISO-8859-1"
795         );
796        $patrik->add
797         ( email    => "him@home.net"
798         );
799
800        my $b = $msg->build(To => $patrik);
801
802        $b->get('To')->print;
803          # ==> =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=
804          #     <him@home.net>
805
806       Field class implementation
807
808       For performance reasons only, there are three types of fields: the
809       fast, the flexible, and the full understander:
810
811       * Mail::Message::Field::Fast
812           "Fast" objects are not derived from a "Mail::Reporter".  The con‐
813           sideration is that fields are so often created, and such a small
814           objects at the same time, that setting-up a logging for each of the
815           objects is relatively expensive and not really useful.  The fast
816           field implementation uses an array to store the data: that will be
817           faster than using a hash.  Fast fields are not easily inheritable,
818           because the object creation and initiation is merged into one
819           method.
820
821       * Mail::Message::Field::Flex
822           The flexible implementation uses a hash to store the data.  The
823           new() and "init" methods are split, so this object is extensible.
824
825       * Mail::Message::Field::Full
826           With a full implementation of all applicable RFCs (about 5), the
827           best understanding of the fields is reached.  However, this comes
828           with a serious memory and performance penalty.  These objects are
829           created from fast or flex header fields when study() is called.
830

DIAGNOSTICS

832       Warning: Field content is not numerical: $content
833
834       The numeric value of a field is requested (for instance the "Lines" or
835       "Content-Length" fields should be numerical), however the data contains
836       weird characters.
837
838       Warning: Illegal character in field name $name
839
840       A new field is being created which does contain characters not permit‐
841       ted by the RFCs.  Using this field in messages may break other e-mail
842       clients or transfer agents, and therefore mutulate or extinguish your
843       message.
844
845       Error: Package $package does not implement $method.
846
847       Fatal error: the specific package (or one of its superclasses) does not
848       implement this method where it should. This message means that some
849       other related classes do implement this method however the class at
850       hand does not.  Probably you should investigate this and probably
851       inform the author of the package.
852

SEE ALSO

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

LICENSE

858       Copyrights 2001-2007 by Mark Overmeer.For other contributors see
859       ChangeLog.
860
861       This program is free software; you can redistribute it and/or modify it
862       under the same terms as Perl itself.  See
863       http://www.perl.com/perl/misc/Artistic.html
864
865
866
867perl v5.8.8                       2007-03-25           Mail::Message::Field(3)
Impressum