|new()||Simple constructor to allow Object Oriented use of this module. If you want to use this, include the package as use File::MimeInfo (); to avoid importing sub mimetype().|
Returns a mimetype string for $file, returns undef on failure.
This method bundles inodetype and globs.
If these methods are unsuccessful the file is read and the mimetype defaults to text/plain or to application/octet-stream when the first ten chars of the file match ascii control chars (white spaces excluded). If the file doesnt exist or isnt readable undef is returned.
|inodetype($file)||Returns a mimetype in the inode namespace or undef when the file is actually a normal file.|
Returns a mimetype string for $file based on the filename and filename extensions.
Returns undef on failure. The file doesnt need to exist.
Behaviour in list context (wantarray) is unspecified and will change in future releases.
|default($file)||This method decides whether a file is binary or plain text by looking at the first few bytes in the file. Used to decide between text/plain and application/octet-stream if all other methods have failed.|
|extensions($mimetype)||In list context, returns the list of filename extensions that map to the given mimetype. In scalar context, returns the first extension that is found in the database for this mimetype.|
Returns a description of this mimetype as supplied by the mime info database.
You can specify a language with the optional parameter $lang, this should be
the two letter language code used in the xml files. Also you can set the global
variable $File::MimeInfo::LANG to specify a language.
This method returns undef when no xml file was found (i.e. the mimetype doesnt exist in the database). It returns an empty string when the xml file doesnt contain a description in the language you specified.
Currently no real xml parsing is done, it trusts the xml files are nicely formatted.
Returns the canonical mimetype for a given mimetype.
Deprecated mimetypes are typically aliased to their canonical variants.
This method only checks aliases, doesnt check whether the mimetype
Use this method as a filter when you take a mimetype as input.
When give only one argument this method returns a list with mimetypes that are parent
classes for this mimetype.
This method checks the subclasses table and applies a few rules for implicit subclasses.
Rehash the data files. Glob information is preparsed when this method is called.
If you want to by-pass the XDG basedir system you can specify your database directories by setting @File::MimeInfo::DIRS. But normally it is better to change the XDG basedir environment variables.
|rehash_aliases()||Rehashes the mime/aliases files.|
|rehash_subclasses()||Rehashes the mime/subclasses files.|
This module throws an exception when it cant find any data files, when it cant open a data file it found for reading or when a subroutine doesnt get enough arguments. In the first case you either dont have the freedesktop mime info database installed, or your environment variables point to the wrong places, in the second case you have the database installed, but it is broken (the mime info database should logically be world readable).
Make an option for using some caching mechanism to reduce init time.
Make describe() use real xml parsing ?
Perl versions prior to 5.8.0 do not have the :utf8 IO Layer, thus for the default method and for reading the xml files utf8 is not supported for these versions.
Jaap Karssenberg <email@example.com> Maintained by Michiel Beijen <firstname.lastname@example.org>
Copyright (c) 2003, 2012 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
File::BaseDir, File::MimeInfo::Magic, File::MimeInfo::Applications, File::MimeInfo::Rox
related CPAN modules File::MMagic freedesktop specifications used <http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec>, <http://www.freedesktop.org/wiki/Specifications/basedir-spec>, <http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec> freedesktop mime database <http://www.freedesktop.org/wiki/Software/shared-mime-info>
|perl v5.20.3||FILE::MIMEINFO (3)||2015-02-23|