Finding Installed Perl Modules

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'