{"id":7287,"date":"2022-12-20T19:37:36","date_gmt":"2022-12-20T22:37:36","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/mimefieldparamval-man3\/"},"modified":"2022-12-20T19:37:36","modified_gmt":"2022-12-20T22:37:36","slug":"mimefieldparamval-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/mimefieldparamval-man3\/","title":{"rendered":"MIME::Field::ParamVal (man3)"},"content":{"rendered":"<h1 align=\"center\">MIME::Field::ParamVal<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#PUBLIC INTERFACE\">PUBLIC INTERFACE<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">MIME::Field::ParamVal \u2212 subclass of Mail::Field, for structured MIME fields<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"># Create an object for a content\u2212type field: <br \/> $field = new Mail::Field &#8216;Content\u2212type&#8217;; <br \/> # Set some attributes: <br \/> $field\u2212>param(&#8216;_&#8217; => &#8216;text\/html&#8217;); <br \/> $field\u2212>param(&#8216;charset&#8217; => &#8216;us\u2212ascii&#8217;); <br \/> $field\u2212>param(&#8216;boundary&#8217; => &#8216;\u2212\u2212\u2212ABC\u2212\u2212\u2212&#8217;); <br \/> # Same: <br \/> $field\u2212>set(&#8216;_&#8217; => &#8216;text\/html&#8217;, <br \/> &#8216;charset&#8217; => &#8216;us\u2212ascii&#8217;, <br \/> &#8216;boundary&#8217; => &#8216;\u2212\u2212\u2212ABC\u2212\u2212\u2212&#8217;); <br \/> # Get an attribute, or undefined if not present: <br \/> print &#8220;no id!&#8221; if defined($field\u2212>param(&#8216;id&#8217;)); <br \/> # Same, but use empty string for missing values: <br \/> print &#8220;no id!&#8221; if ($field\u2212>paramstr(&#8216;id&#8217;) eq &#8221;); <br \/> # Output as string: <br \/> print $field\u2212>stringify, &#8220;n&#8221;;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This is an abstract superclass of most <small>MIME<\/small> fields. It handles fields with a general syntax like this:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Content\u2212Type: Message\/Partial; <br \/> number=2; total=3; <br \/> id=&#8221;oc=jpbe0M2Yt4s@thumper.bellcore.com&#8221;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Comments are supported <i>between<\/i> items, like this:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Content\u2212Type: Message\/Partial; (a comment) <br \/> number=2 (another comment) ; (yet another comment) total=3; <br \/> id=&#8221;oc=jpbe0M2Yt4s@thumper.bellcore.com&#8221;<\/p>\n<h2>PUBLIC INTERFACE <a name=\"PUBLIC INTERFACE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">set [%PARAMHASH | KEY=> <small>VAL,&#8230;<\/small> ,KEY=> <small>VAL<\/small> ]<\/p>\n<p style=\"margin-left:17%;\"><i>Instance method.<\/i> Set this field. The paramhash should contain parameter names in <i>all lowercase<\/i>, with the special &#8220;_&#8221; parameter name signifying the &#8220;default&#8221; (unnamed) parameter for the field:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"># Set up to be&#8230; <br \/> # <br \/> # Content\u2212type: Message\/Partial; number=2; total=3; id=&#8221;ocj=pbe0M2&#8243; <br \/> # <br \/> $conttype\u2212>set(&#8216;_&#8217; => &#8216;Message\/Partial&#8217;, <br \/> &#8216;number&#8217; => 2, <br \/> &#8216;total&#8217; => 3, <br \/> &#8216;id&#8217; => &#8220;ocj=pbe0M2&#8221;);<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Note that a single argument is taken to be a <i>reference<\/i> to a paramhash, while multiple args are taken to be the elements of the paramhash themselves.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Supplying undef for a hashref, or an empty set of values, effectively clears the object.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The self object is returned.<\/p>\n<p style=\"margin-left:11%;\">parse_params <small>STRING<\/small><\/p>\n<p style=\"margin-left:17%;\"><i>Class\/instance utility method.<\/i> Extract parameter info from a structured field, and return it as a hash reference. For example, here is a field with parameters:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Content\u2212Type: Message\/Partial; <br \/> number=2; total=3; <br \/> id=&#8221;oc=jpbe0M2Yt4s@thumper.bellcore.com&#8221;<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Here is how you\u2019d extract them:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$params = $class\u2212>parse_params(&#8216;content\u2212type&#8217;); <br \/> if ($$params{&#8216;_&#8217;} eq &#8216;message\/partial&#8217;) { <br \/> $number = $$params{&#8216;number&#8217;}; <br \/> $total = $$params{&#8216;total&#8217;}; <br \/> $id = $$params{&#8216;id&#8217;}; <br \/> }<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Like field names, parameter names are coerced to lowercase. The special \u2019_\u2019 parameter means the default parameter for the field.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><b><small>NOTE:<\/small><\/b> This has been provided as a public method to support backwards compatibility, but you probably shouldn\u2019t use it.<\/p>\n<p style=\"margin-left:11%;\">parse <small>STRING<\/small><\/p>\n<p style=\"margin-left:17%;\"><i>Class\/instance method.<\/i> Parse the string into the instance. Any previous information is wiped. The self object is returned.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">May also be used as a constructor.<\/p>\n<p style=\"margin-left:11%;\">param <small>PARAMNAME<\/small> ,[ <small>VALUE<\/small> ]<\/p>\n<p style=\"margin-left:17%;\"><i>Instance method.<\/i> Return the given parameter, or undef if it isn\u2019t there. With argument, set the parameter to that <small>VALUE.<\/small> The <small>PARAMNAME<\/small> is case-insensitive. A &#8220;_&#8221; refers to the &#8220;default&#8221; parameter.<\/p>\n<p style=\"margin-left:11%;\">paramstr <small>PARAMNAME<\/small> ,[ <small>VALUE<\/small> ]<\/p>\n<p style=\"margin-left:17%;\"><i>Instance method.<\/i> Like <b>param()<\/b>: return the given parameter, or <i>empty<\/i> if it isn\u2019t there. With argument, set the parameter to that <small>VALUE.<\/small> The <small>PARAMNAME<\/small> is case-insensitive. A &#8220;_&#8221; refers to the &#8220;default&#8221; parameter.<\/p>\n<p style=\"margin-left:11%;\">stringify<\/p>\n<p style=\"margin-left:17%;\"><i>Instance method.<\/i> Convert the field to a string, and return it.<\/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=\"4%\">\n<p>tag<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p><i>Instance method, abstract.<\/i> Return the tag for this field.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Mail::Field<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  MIME::Field::ParamVal \u2212 subclass of Mail::Field, for structured MIME 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":[3007,3610],"class_list":["post-7287","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-mimefieldparamval"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7287","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=7287"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7287\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}