n:~$perl -MFile::Find=find -le 'find { wanted => sub { print $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
To find out where Foo.pm is located you could use
n:~$perl -MFile::Find=find -le 'find { wanted => sub { print $_ if /\.pm\z/ }, no_chdir => 1 }, @INC' |grep -i foo
But, I know that you like putting your best modules along with your homebrewed modules in that non standard directory --/usr/scripts/lib/
Then you could do the following to list all your perl modules
n:~$perl -MFile::Find=find -le 'push "/usr/scripts/lib/",@INC; find { wanted => sub { if($_ =~ /\.pm\z/) { print "$_"; } }, no_chdir => 1 }, @INC'
And, because I know that you are not going to type all this every time you want to list your modules or find where Foo.pm is let's make the above one liner a bash function or an alias and put it in .bashrc
n:~$head -3 .bashrc function lspm { perl -MFile::Find=find -le 'push(@INC,"/usr/scripts/lib/"); find { wanted => sub { if($_ =~ /\.pm\z/) { print "$_"; } }, no_chdir => 1 }, @INC' } n:~$source .bashrc
So, where is Foo.pm?
n:~$lspm | grep -i foo /usr/share/perl5/Foomatic/Defaults.pm /usr/share/perl5/Foomatic/UIElem.pm /usr/share/perl5/Foomatic/PPD.pm /usr/share/perl5/Foomatic/DB.pm /usr/scripts/lib/Foo.pmduh!
And how many modules do I have?
n:~$lspm |wc -l 1503;)