MIME::Field::ParamVal − subclass of Mail::Field, for structured MIME fields
# Create an object for a content−type field:
$field = new Mail::Field 'Content−type';
# Set some attributes:
$field−>param('_' => 'text/html');
$field−>param('charset' => 'us−ascii');
$field−>param('boundary' => '−−−ABC−−−');
# Same:
$field−>set('_' => 'text/html',
'charset' => 'us−ascii',
'boundary' => '−−−ABC−−−');
# Get an attribute, or undefined if not present:
print "no id!" if defined($field−>param('id'));
# Same, but use empty string for missing values:
print "no id!" if ($field−>paramstr('id') eq '');
# Output as string:
print $field−>stringify, "\n";
This is an abstract superclass of most MIME fields. It handles fields with a general syntax like this:
Content−Type: Message/Partial;
number=2; total=3;
id="oc=jpbe0M2Yt4s@thumper.bellcore.com"
Comments are supported between items, like this:
Content−Type: Message/Partial; (a comment)
number=2 (another comment) ; (yet another comment) total=3;
id="oc=jpbe0M2Yt4s@thumper.bellcore.com"
set [\%PARAMHASH | KEY=> VAL ,...,KEY=> VAL ]
Instance method. Set this field. The paramhash should contain parameter names in all lowercase, with the special "_" parameter name signifying the "default" (unnamed) parameter for the field:
# Set up to be...
#
# Content−type: Message/Partial; number=2; total=3; id="ocj=pbe0M2"
#
$conttype−>set('_' => 'Message/Partial',
'number' => 2,
'total' => 3,
'id' => "ocj=pbe0M2");
Note that a single argument is taken to be a reference to a paramhash, while multiple args are taken to be the elements of the paramhash themselves.
Supplying undef for a hashref, or an empty set of values, effectively clears the object.
The self object is returned.
parse_params STRING
Class/instance utility method. Extract parameter info from a structured field, and return it as a hash reference. For example, here is a field with parameters:
Content−Type: Message/Partial;
number=2; total=3;
id="oc=jpbe0M2Yt4s@thumper.bellcore.com"
Here is how you’d extract them:
$params = $class−>parse_params('content−type');
if ($$params{'_'} eq 'message/partial') {
$number = $$params{'number'};
$total = $$params{'total'};
$id = $$params{'id'};
}
Like field names, parameter names are coerced to lowercase. The special ’_’ parameter means the default parameter for the field.
NOTE: This has been provided as a public method to support backwards compatibility, but you probably shouldn’t use it.
parse STRING
Class/instance method. Parse the string into the instance. Any previous information is wiped. The self object is returned.
May also be used as a constructor.
param PARAMNAME ,[ VALUE ]
Instance method. Return the given parameter, or undef if it isn’t there. With argument, set the parameter to that VALUE . The PARAMNAME is case-insensitive. A "_" refers to the "default" parameter.
paramstr PARAMNAME ,[ VALUE ]
Instance method. Like param(): return the given parameter, or empty if it isn’t there. With argument, set the parameter to that VALUE . The PARAMNAME is case-insensitive. A "_" refers to the "default" parameter.
stringify
Instance method. Convert the field to a string, and return it.
tag |
Instance method, abstract. Return the tag for this field. |
Mail::Field
Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.
Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.
Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.
Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.
The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.
Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.
Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.
Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.