Courriel::ContentType - The content type for an email part
version 0.10
my $ct = $part->content_type(); print $ct->mime_type(); print $ct->charset(); my %attr = $ct->attributes(); while ( my ( $k, $v ) = each %attr ) { print "$k => $v\n"; }
This class represents the contents of a "Content-Type" header attached to an email part. Such headers always include a mime type, and may also include additional information such as a charset or other attributes.
Here are some typical headers:
Content-Type: text/plain; charset=utf-8 Content-Type: multipart/alternative; boundary=abcdefghijk Content-Type: image/jpeg; name="Filename.jpg"
This class supports the following methods:
This method creates a new object. It accepts the following parameters:
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. This is optional, and can be empty.
Returns the mime type value passed to the constructor.
Returns the charset for the content type.
This defaults to the value found in the attributes or "us-ascii" as a fallback.
Returns a hash (not a reference) of the attributes passed to the constructor.
Given a key, returns the value of the named attribute. Obviously, this value can be undef if the attribute doesn't exist.
undef
Returns the object as a string suitable for a header value (but not folded).
Dave Rolsky <autarch@urth.org>
This software is Copyright (c) 2011 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Courriel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Courriel
CPAN shell
perl -MCPAN -e shell install Courriel
For more information on module installation, please visit the detailed CPAN module installation guide.