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 /\.pm\z/ }, no_chdir => 1 }, @INC'






September 2nd, 2004 at 11:59 am
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 /\.pm\z/ }, no_chdir => 1 }, @INC”
Thanks!
U
September 4th, 2004 at 8:29 am
Blane, can you list some of these “obfuscated” error messages?
September 27th, 2004 at 1:48 am
whats wrong w print @INC ?
October 8th, 2004 at 4:41 pm
would it be an exercise in futility to write
cpm/86 in perl ? A NICE EMULATOR ALSO CPM/80
FOR THE Z80 ANTOPSYS LOOK FOR ANTIQUE OPERATING SYSTEMS IN MSN GROUPS
October 12th, 2004 at 8:31 pm
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…
November 21st, 2004 at 12:38 am
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 sitepoint.com and I’m sure these people will take down this comment and ignore it.
November 24th, 2004 at 12:37 pm
this (what perl mods are installed) was exactly what I was looking for. Thanks
March 22nd, 2006 at 1:12 am
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?
May 6th, 2006 at 4:21 am
what about perldoc
Simple and easy check if you have module installed,
Also its documentation
May 6th, 2006 at 4:22 am
there was some problem in my previous post
I meant Perldoc MODULENAME
May 23rd, 2006 at 3:40 pm
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 — $version\n”;
}
BUT is there a way in which i can find modules installed on a particular directory
example :- All modules installed under /home/username
February 7th, 2008 at 12:29 am
there is easy way to find installed modules
Run this command
perl -MModule::Name -e l