| Module Info
| Add a review of File-MMagic
Works for basic usage, but has quite a few problems. Plus it is not very performant. Doesn't seem to be maintained anymore.
The currently recommended module in this area seems to be File::LibMagic. Other alternatives include File::Type (gives less useful results), File::MMagic::XS (also not actively maintained? long standing bugs like failure to parse system magic file still persists), Media::Type::Simple (only maps MIME type from/to file extension).
This library has a great concept, but has suffered massive bit rot since it was last maintained in 2006.
Here are my main problems with the library:
1. There is no support for multi-file magic (my system has moved to a directory-based magic file system).
2. No support for newer file(1) magic syntax: cannot detect image/png using system magic from file(1) version 5.04.
2a. Not very code-hardy: code is broken by newer/unrecognized magic file syntax.
3. There are four undocumented subs which show up in the documentation, but tell nothing of their use.
4. No support for character set detection.
5. No support for long file type descriptions ("PNG image data, xxx x yyy, ...").
All in all, I would not recommend using this module until it is maintained; File::LibMagic seems like it will give you better results.
This is a handy module for determining the the file type of a file by examining its contents. However, it some serious bugs (currently 19 are open), and hasn't been updated in two years. I personally ran into problems with bad results under mod_perl.
I would strongly suggest looking for alternatives before using this module. If you just need to check common web image formats, File::Type::WebImages is a simple module for that purpose. It was written precisely because File::MMagic had problems in mod_perl.