Contentment::MIMETypes - Standard interface to MIME::Types
my $types = Contentment::MIMETypes->instance; my $type = $types->mimeTypeOf('foo.txt');
This provides a common repository for MIME types used by Contentment. MIME types are a far from perfect way of determining the file type of a file. This is further aggravated by the fact that a file extension isn't really a very good way to map between MIME types and content types.
This is why the Contentment system tries to avoid relying on MIME types directly using the concept of "file kind" instead. However, for all practical purposes file kinds tend to be the same thing as MIME Types.
This class provides a place to register the standard list of MIME types, since the default implementation doesn't contain all the types needed.
To use this class, just call the
instance() method to retrieve an instance. The rest of the API is identical to MIME::Types.
If you wish to customize the MIME types. You may either modify the instance returned by
instance() directly, or you can register with the "Contentment::MIMETypes::register" hook which is called when the singleton Contentment::MIMETypes object is initially instantiated.
This class adds the following context method:
This hook is called the first time the
instance() method is called. Each handler will be passed the freshly constructed MIME::Types object for modification.
Andrew Sterling Hanenkamp, <firstname.lastname@example.org>
Copyright 2005 Andrew Sterling Hanenkamp <email@example.com>. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.