NAME
MIME::Types - Perl extension for determining MIME types and Transfer Encoding
SYNOPSIS
use MIME::Types;
($media_type, $content_transfer_encoding) = MIME::Types::by_suffix(FILENAME);
@LIST = MIME::Types::by_mediatype(MEDIATYPE);
DESCRIPTION
NOTE: This is ALPHA code. There are no guarantees that any of the subroutines described here will not have their names or return values changed.
This module is built to conform to the MIME types standard defined in RFC 1341 and updated by RFC's 1521 and 1522. It follows the collection kept at http://www.ltsw.se/knbase/internet/mime.htp.
The following functions are available:
- by_suffix
-
This function takes either a file name suffix or a complete file name. It returns a two-element list if the suffix can be found: the media type and a content encoding. An empty list is returned if the suffix could not be found.
- by_mediatype
-
This function takes a media type and returns an array containing references to a three-element list whose values are the file name suffix used to identify it, the media type, and a content encoding.
If the media type contains a slash (/), it is assumed to be a complete media type and must exactly match against the internal table. Otherwise the value is simply compared to all the values in the table. Thus, calling by_mediatype("application") will return a large list.
AUTHOR
Jeff Okamoto (okamoto@corp.hp.com). Inspired by the mail_attach.pl program by Dan Sugalski (dan@sidhe.org).