I often peek into Perl Module source code to add debugging logs, or to find or narrow down problems. and have to spend sometime always to find where that module is installed.
Following script was implemented to save me sometime:
use strict; use warnings; my $package = $ARGV[0]; my @arr = split('::', $package); my $packagePath = join('/', @arr); foreach my $path (@INC) { if(-f $path."/".$packagePath.".pm") { print "$package found at: $path/$packagePath.pm\n"; last; } } e.g.: -bash-3.2$ perl findPerlPackage.pl Net::SSH2 Net::SSH2 found at: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Net/SSH2.pm
Leave a Reply