Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

perl library path

Tags:

linux

unix

perl

I need to retrieve the path where the perl libraries Statistics and Distributions are located. The path is necessary to run the script. I'm on a computer cluster. Can anyone help me?

Thanks

like image 453
Elb Avatar asked Sep 07 '12 14:09

Elb


2 Answers

This answer assumes that the module is in fact installed, but not in a place that perl is looking for.

Generally, the Perl module Statistics::Distributions will be contained in a file called Statistics/Distributions.pm. On Linux and similar systems, one can search for these files quickly with the locate command:

locate Statistics/Distributions.pm

If it is installed, locate will spit out a line similar to

/opt/my_perl/lib/Statistics/Distributions.pm

You can then instruct the perl interpreter to look in this path, too, in various ways. One is to define the environment variable PERL5LIB, i.e. from bash:

prompt> PERL5LIB=/opt/my_perl/lib/ ./myscript.pl

Or you can use the perl -I switch:

prompt> perl -I/opt/my_perl/lib/ ./myscript.pl

Or you can modify the script to use lib; there is more than one way to do it ;-)

like image 143
Ben Deutsch Avatar answered Oct 20 '22 19:10

Ben Deutsch


perldoc -m Your::Module - displays source of module

perldoc -l Your::Module - display path to library if it's installed and found in PERL5LIB, -I, @INC, etc.

like image 24
Sergey Sinkovskiy Avatar answered Oct 20 '22 20:10

Sergey Sinkovskiy