| Module Info
MIME::Types seems to work well enough. Its results are almost, but not quite, identical to File::MimeInfo. For example an Excel file gets this:
but a bmp file gets this:
Unlike Media::Type::Simple it returns an undefined value when it sees an extension it doesn't recognise, rather than throw a fatal error. Unlike File::MimeInfo, it doesn't try to open the file and guess what is inside it.
For a full comparison including source code and results on various files, see
The object-oriented interface is a bit cumbersome, e.g. $type = (MIME::Types->new)->type(shift).
I don't understand the relationship between the MIME::Types and MIME::Type modules: they seem to have the same POD.
I just want to be able to get a MIME-Type from an extension, and to get a list of extensions associated with a MIME-Type.
A bigger annoyance is that the list is rather small.
I wish it could give a "common" extension for MIME-Type (in particular, a 3-character extension), so that I can use it for normalising file names.
Moaning aside, I was able to get what I needed from it quickly.
Edit: I have since written a module Media::Type::Simple that takes care of my moans...