This class supports the following methods:
Courriel::Header::ContentType->new_from_value(...)
This takes two parameters, "name" and "value". The "name" is optional, and defaults to "Content-Type".
The "value" is parsed and split up into the mime type and attributes.
Courriel::Header::ContentType->new(...)
This method creates a new object. It accepts the following parameters:
• name
This defaults to 'Content-Type'.
• value
This is the full header value.
• mime_type
A string like "text/plain" or "multipart/alternative". This is required.
• attributes
A hash reference of attributes from the header, such as a boundary, charset, etc. The keys are
attribute names and the values can either be strings or Courriel::HeaderAttribute objects. Values
which are strings will be inflated into objects by the constructor.
This is optional, and can be an empty hash reference or omitted entirely.
$ct->name()
The header name, usually "Content-Type".
$ct->value()
The raw header value.
$ct->mime_type()
Returns the mime type value passed to the constructor. However, this value will be in all lower-case,
regardless of the original casing passed to the constructor.
$ct->charset()
Returns the charset for the content type, which will be the value found in the "attributes", if one
exists.
$ct->attributes()
Returns a hash (not a reference) of the attributes passed to the constructor.
Attributes are Courriel::HeaderAttribute objects.
The keys of the hash are all lower case, though the original casing is preserved in the "name()" returned
by the Courriel::HeaderAttribute object.
$ct->is_binary()
Returns true unless the attachment looks like text data. Currently, this means that is has a charset
defined and the charset is not "binary".
$ct->attribute($key)
Given a key, returns the named Courriel::HeaderAttribute object. Obviously, this value can be "undef" if
the attribute doesn't exist. Name lookup is case-insensitive.
$ct->attribute_value($key)
Given a key, returns the named attribute's value as a string. Obviously, this value can be "undef" if the
attribute doesn't exist. Name lookup is case-insensitive.
The attribute is a Courriel::HeaderAttribute object.
$ct->as_header_value()
Returns the object as a string suitable for a header value (but not folded). Note that this uses the
original casing of the mime type as passed to the constructor.