{"id":7122,"date":"2022-12-20T19:35:33","date_gmt":"2022-12-20T22:35:33","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/mailfield-man3\/"},"modified":"2022-12-20T19:35:33","modified_gmt":"2022-12-20T22:35:33","slug":"mailfield-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/mailfield-man3\/","title":{"rendered":"Mail::Field (man3)"},"content":{"rendered":"<h1 align=\"center\">Mail::Field<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#INHERITANCE\">INHERITANCE<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#DETAILS\">DETAILS<\/a><br \/> <a href=\"#DIAGNOSTICS\">DIAGNOSTICS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#LICENSE\">LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Field \u2212 base\u2212class for manipulation of mail header fields<\/p>\n<h2>INHERITANCE <a name=\"INHERITANCE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Field is extended by <br \/> Mail::Field::AddrList <br \/> Mail::Field::Date <br \/> Mail::Field::Generic<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use Mail::Field; <br \/> my $field = Mail::Field\u2212>new(&#8216;Subject&#8217;, &#8216;some subject text&#8217;); <br \/> my $field = Mail::Field\u2212>new(Subject => &#8216;some subject text&#8217;); <br \/> print $field\u2212>tag,&#8221;: &#8220;,$field\u2212>stringify,&#8221;n&#8221;; <br \/> my $field = Mail::Field\u2212>subject(&#8216;some subject text&#8217;);<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">&#8220;Mail::Field&#8221; creates and manipulates fields in <small>MIME<\/small> headers, collected within a Mail::Header object. Different field types have their own sub-class (extension), defining additional useful accessors to the field content.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">People are invited to merge their implementation to special fields into MailTools, to maintain a consistent set of packages and documentation.<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Constructors<\/b> <br \/> Mail::Field (and it\u2019s sub-classes) define several methods which return new objects. These can all be categorized as constructor. <br \/> Mail::Field\u2212><b>combine<\/b>($fields)<\/p>\n<p style=\"margin-left:17%;\">Take a <small>LIST<\/small> of &#8220;Mail::Field&#8221; objects (which should all be of the same sub-class) and create a new object in that same class.<\/p>\n<p style=\"margin-left:11%;\">Mail::Field\u2212><b>extract<\/b>( $tag, $head [, $index ] )<\/p>\n<p style=\"margin-left:17%;\">Takes as arguments the tag name, a &#8220;Mail::Head&#8221; object and optionally an index.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">If the index argument is given then &#8220;extract&#8221; will retrieve the given tag from the &#8220;Mail::Head&#8221; object and create a new &#8220;Mail::Field&#8221; based object. <i>undef<\/i> will be returned in the field does not exist.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">If the index argument is not given the result depends on the context in which &#8220;extract&#8221; is called. If called in a scalar context the result will be as if &#8220;extract&#8221; was called with an index value of zero. If called in an array context then all tags will be retrieved and a list of &#8220;Mail::Field&#8221; objects will be returned.<\/p>\n<p style=\"margin-left:11%;\">Mail::Field\u2212><b>new<\/b>( $tag [, <small>STRING<\/small> | %options] )<\/p>\n<p style=\"margin-left:17%;\">Create an object in the class which defines the field specified by the $tag argument.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>&#8220;Fake&#8221; constructors<\/b> <br \/> $obj\u2212><b>create<\/b>(%options)<\/p>\n<p style=\"margin-left:17%;\">This constructor is used internally with preprocessed field information. When called on an existing object, its original content will get replaced.<\/p>\n<p style=\"margin-left:11%;\">$obj\u2212><b>parse<\/b>()<\/p>\n<p style=\"margin-left:17%;\">Parse a field line.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Accessors<\/b> <br \/> $obj\u2212><b>set<\/b>(%options)<\/p>\n<p style=\"margin-left:17%;\">Change the settings (the content, but then smart) of this field.<\/p>\n<p style=\"margin-left:11%;\">$obj\u2212><b>stringify<\/b>()<\/p>\n<p style=\"margin-left:17%;\">Returns the field as a string.<\/p>\n<p style=\"margin-left:11%;\">$obj\u2212><b>tag<\/b>() <br \/> Mail::Field\u2212><b>tag<\/b>()<\/p>\n<p style=\"margin-left:17%;\">Return the tag (in the correct case) for this item. Well, actually any casing is <small>OK,<\/small> because the field tags are treated case-insensitive; however people have some preferences.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Smart accessors<\/b> <br \/> $obj\u2212><b>text<\/b>( [ <small>STRING<\/small> ] )<\/p>\n<p style=\"margin-left:17%;\">Without arguments, the field is returned as <b>stringify()<\/b> does. Otherwise, the <small>STRING<\/small> is parsed with <b>parse()<\/b> to replace the object\u2019s content.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">It is more clear to call either <b>stringify()<\/b> or <b>parse()<\/b> directly, because this method does not add additional processing.<\/p>\n<h2>DETAILS <a name=\"DETAILS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>SUB-CLASS <small>PACKAGE NAMES<\/small><\/b> <br \/> All sub-classes should be called Mail::Field::<i>name<\/i> where <i>name<\/i> is derived from the tag using these rules.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Consider a tag as being made up of elements separated by \u2019\u2212\u2019<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Convert all characters to lowercase except the first in each element, which should be uppercase.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p><i>name<\/i> is then created from these elements by using the first N characters from each element.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>N is calculated by using the formula :\u2212<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">int((7 + #elements) \/ #elements)<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\"><i>name<\/i> is then limited to a maximum of 8 characters, keeping the first 8 characters.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">For an example of this take a look at the definition of the &#8220;_header_pkg_name()&#8221; subroutine in &#8220;Mail::Field&#8221;<\/p>\n<h2>DIAGNOSTICS <a name=\"DIAGNOSTICS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Error: Undefined subroutine <method> called<\/p>\n<p style=\"margin-left:17%;\">Mail::Field objects use autoloading to compile new functionality. Apparently, the method called is not implemented for the specific class of the field object.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This module is part of the MailTools distribution, <i>http:\/\/perl.overmeer.net\/mailtools\/<\/i>.<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.<\/p>\n<h2>LICENSE <a name=\"LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyrights 1995\u22122000 Graham Barr <gbarr@pobox.com> and 2001\u22122017 Mark Overmeer <perl@overmeer.net>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself. See <i>http:\/\/www.perl.com\/perl\/misc\/Artistic.html<\/i><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Mail::Field \u2212 base\u2212class for manipulation of mail header fields <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3461,3007],"class_list":["post-7122","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-mailfield","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7122"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7122\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}