Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

File::MimeInfo::Magic in Windows

by pankaj_it09 (Scribe)
on Apr 29, 2014 at 13:01 UTC ( #1084319=perlquestion: print w/replies, xml ) Need Help??

pankaj_it09 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

The above mentioned package requires shared-mime-info database .
I downloaded the database and tried integrating it.
Unable to do so.
How to do that ?

Below is the code -->
use strict; use File::MimeInfo::Magic; use File::Find 'find'; open(FILE,'>>','fileType.csv'); my $inputDirectory = 'F:/'; find({wanted => sub {\&scanFiles();},no_chdir => 1},$inputDirectory); sub scanFiles { my $mimeType = mimetype($File::Find::name); print FILE "$File::Find::name,$mimeType\n"; } close(FILE);
Below is the warning -->

WARNING: You don't seem to have a mime-info database. The shared-mime-info package is available from

Replies are listed 'Best First'.
Re: File::MimeInfo::Magic in Windows
by marto (Cardinal) on Apr 29, 2014 at 13:30 UTC

    The devil is in the detail. What you haven't explicitly told us in this post is that you're using Microsoft Windows (as you mentioned in the Chatterbox). What you didn't notice was the warnings when you installed the required modules:

    t/00_use_ok.t ...... 1/4 WARNING: You don't seem to have any mimeinfo. +cache files. Try running the update-desktop-database command. If you don't have this command you should install the desktop-file-utils package. This package is available from

    I suggest you investigate these issues. It looks as though there are Windows ports of what's required (shared-mime-info, parts of gnuwin32) etc.

    Update: Reworded, added some links.

Re: File::MimeInfo::Magic in Windows
by Anonymous Monk on Apr 30, 2014 at 00:07 UTC
    When you download the mime database, stuff it into File::BaseDir::xdg_data_home() ... yeah, real smooth I know

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1084319]
Approved by GotToBTru
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-03-05 23:04 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (115 votes). Check out past polls.