SYNOPSIS

 use MIME::Types;
 my $mt    = MIME::Types->new(...);    # MIME::Types object
 my $type  = $mt->type('text/plain');  # MIME::Type  object
 my $type  = $mt->mimeTypeOf('gif');
 my $type  = $mt->mimeTypeOf('picture.jpg');
 my @types = $mt->httpAccept('text/html, application/json;q=0.1')

DESCRIPTION

MIME types are used in many applications (for instance as part of e-mail and HTTP traffic) to indicate the type of content which is transmitted. or expected. See RFC2045 at https://www.ietf.org/rfc/rfc2045.txt

Sometimes detailed knowledge about a mime-type is need, however this module only knows about the file-name extensions which relate to some filetype. It can also be used to produce the right format: types which are not registered at IANA need to use 'x-' prefixes.

This object administers a huge list of known mime-types, combined from various sources. For instance, it contains all IANA types and the knowledge of Apache. Probably the most complete table on the net!

MIME::Types and daemons (fork)

If your program uses fork (usually for a daemon), then you want to have the type table initialized before you start forking. So, first call

   my $mt = MIME::Types->new;

Later, each time you create this object (you may, of course, also reuse the object you create here) you will get access to the same global table of types.