If you're working on a system that has multiple versions of perl installed with perhaps multiple users and a few different library locations, you might be confused about where to look when you get a problem related to a module. Where is the code for that module actually located? Got more than one of those modules installed in different places, which one is being used? Which version?

There are a few different ways to clear up the mystery. First you might want to get a list of what modules and what versions you have installed via CPAN.

use ExtUtils::Installed;
$i = ExtUtils::Installed->new();
foreach($i->modules()) {
        print "$_ ".$i->version($_)."\n";
}

If you want the file pathname to a particular module that will be used, for example Test::More, try this one-liner from the command line:

 perl -e 'print shift @{[grep{$_.="/Test/More.pm", -e} @INC]};'

And if the module has documentation (as all should) this should work too:

perldoc -l Test::More