in reply to Looking for a name (Magic number MIME information on file from freedesktop.org database)
How about MIME::Detect which could implement
a generic API or a driver (like DBI) that can interface to various backends like
the ones you already listed?
MIME::Detect::SharedMimeInfoXML could then be one of many backends.
my $mime_detector = MIME::Detect->new( driver => 'auto' );
could auto-select an available backend.
my $mime_detector = MIME::Detect->new( driver => 'SharedMimeInfoXML' );
would ask for a specific driver explicitly.
More work needs to be done for the API to cover most of the existing functionality, though. However, work already done by others can be preserved and made available in a generic way.
Leaving the FILE:: namespace aside would also allow to broaden the application of MIME-detection to streams (i.e. using IO::Handle), strings, etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Looking for a name (Magic number MIME information on file from freedesktop.org database)
by Corion (Patriarch) on Sep 17, 2016 at 21:06 UTC |