How do get the path of a installed Perl module by name,
e.g. Time::HiRes
?
I want this just because I have to run my perl script on different nodes of a SGE
In OSX you can use:
perl -e 'print join("\n",@INC)'
The result should be the location of your lib.
Then add this code in your Perl code:
use lib '/your/folder/location/to/lib';
If need to find which modules are actually used by your script you can use perl debuggers M
command:
[ivan@server ~]$ perl -d your_script.pl ... Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB M 'AutoLoader.pm' => '5.60 from /usr/lib/perl5/5.8.8/AutoLoader.pm' 'Carp.pm' => '1.04 from /usr/lib/perl5/5.8.8/Carp.pm' ...
This will help in case when you have modules with same names but in different folder.
perl -MTime::HiRes -e 'print $INC{"Time/HiRes.pm"}'
or perldoc -l Time::HiRes