Again, I turn to you in search of a name:

Fed up with the existing solutions to determining the MIME type of a file using the magic numbers, I wrote a module to parse the XML database that is distributed by the freedesktop.org initiative at https://www.freedesktop.org/wiki/Software/shared-mime-info/.

This module allows an application to use its own rules for file type recognition independent of what other rules the operating system may have installed. Also, you gain independence of needing tools like autoconf being available for your platform.

The "problem" I have is coming up with a good name for this module. In the same problem space, there already are:

Currently, my file is not API-compatible with either of them (yet), so I'm not feeling exactly like using one of the above namespaces.

My current bad candidates are:

  1. File::MIME::Magic - my current favourite, has both, "MIME" and "Magic" in the name, which are the two search terms to use when finding the mime type of a file
  2. File::Magic - a great name, but squats on a not too bad namespace
  3. File::Magic::FreeDesktop - leaves File::Magic open for other improvements
  4. File::Magic::XML - somehow suggests that we only look at XML files?!
  5. File::MimeInfo::SharedMimeInfoXML - confusing because I don't implement the File::MimeInfo API

While it's always fun to write my own modules, if you know of other fairly general file type modules, feel free to also mention them here. There are some type-specific modules for audio and image files, which may be enough, depending on your application.

Update: The current API is the following:

my $mime = File::MimeInfo::SharedMimeInfoXML->new(); for my $file (@ARGV) { print sprintf "%s: %s\n", $file, $_->mime_type for $mime->mimetypes($file); };

In reply to Looking for a name (Magic number MIME information on file from freedesktop.org database) by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.