Finding Installed Perl Modules

By Blane Warrene

In working with numerous servers, some my own and many under client ownership, I bump into interesting issues to tackle (yep, this is obvious I know, we all do!). As most of us do now when stumped, a first resort is to Google the problem and see who has already resolved it.

Just a few weeks ago I was wrestling with a web-based Perl application problem for some advanced scripts that I had not authored and became convinced it was related to modules (does anyone else get flustered with obfuscated Perl error messages?!).

I happened to have a snippet of code for identifying all modules installed tucked away and was finally able to track down which module was not installed that resolved the issue.

Perhaps other will find some value in being able to generate lists of modules installed. A disclaimer on this code – I remember finding it through a Google search sometime back (at least a year ago) – but cannot track back down who posted it and where. So – for insuring proper credit is issued – I did not author this handy little piece.

perl -MFile::Find=find -MFile::Spec::Functions -lwe 'find { wanted => sub { print canonpath $_ if /.pmz/ }, no_chdir => 1 }, @INC'

  • ultra

    My Windoze install wanted double quotes for this very helpful one-liner;

    Here’s the modified code:

    perl -MFile::Find=find -MFile::Spec::Functions -lwe “find { wanted => sub { print canonpath $_ if /.pmz/ }, no_chdir => 1 }, @INC”


  • Sergey

    Blane, can you list some of these “obfuscated” error messages?

  • Anonymous

    whats wrong w print @INC ?

  • lawrephord2

    would it be an exercise in futility to write
    cpm/86 in perl ? A NICE EMULATOR ALSO CPM/80

  • Mark Aufflick

    If you have a particular module you want to find out about, I just do this:

    perl -MMy::Module -e ‘print 1’

    if the module doesn’t exist you will get an error (and @INC to boot) – if it does exist you will get a 1 printed out.

    Real easy to remember too…

  • Fred

    What a terrible site this is. I can’t scroll in the usual way and then they put this code in a non-standard text box where I can’t evn do a select all.

    …stupid and useless.

    I won’t be back to and I’m sure these people will take down this comment and ignore it.

  • bhbriggs

    this (what perl mods are installed) was exactly what I was looking for. Thanks

  • aperson

    For people like Fred.

    Maybe you need to update your browser, it all works with a modern browser that handles CSS! Why not try Firefox?

  • vasundhar

    what about perldoc

    Simple and easy check if you have module installed,
    Also its documentation

  • vasundhar

    there was some problem in my previous post
    I meant Perldoc MODULENAME

  • Dinesh

    Use this script to see the modules installed on your system OR type perldoc perllocal

    #!/usr/bin/perl -w

    use ExtUtils::Installed;
    my $instmod = ExtUtils::Installed->new();
    foreach my $module ($instmod->modules()) {
    my $version = $instmod->version($module) || “Version Not Found”;
    print “$module — $versionn”;

    BUT is there a way in which i can find modules installed on a particular directory
    example :- All modules installed under /home/username

  • Raj Shivage

    there is easy way to find installed modules
    Run this command
    perl -MModule::Name -e l

Get the latest in Front-end, once a week, for free.