If you would like to just test a newer version of a module, I'd recommend the command line flag: perl -I /path/to/lib.
perl -I /home/foobar/code script.pl
If you are installing lots of modules in a private directory then I'd probably use PERL5LIB though we'll also see local::lib that does this for you.
export PERL5LIB=/home/foobar/code
use lib is used in two cases:
One: When you have a fixed, but not standard company-wide environment in which you put modules in a common standard location.
Two: When you are developing an application and you'd like to make sure the script always picks up the modules relative to their own location. We'll discuss this in another post.
use lib '/home/foobar/code';
use My::Module;
perl -I /home/foobar/code script.pl
If you are installing lots of modules in a private directory then I'd probably use PERL5LIB though we'll also see local::lib that does this for you.
export PERL5LIB=/home/foobar/code
use lib is used in two cases:
One: When you have a fixed, but not standard company-wide environment in which you put modules in a common standard location.
Two: When you are developing an application and you'd like to make sure the script always picks up the modules relative to their own location. We'll discuss this in another post.
use lib '/home/foobar/code';
use My::Module;
No comments:
Post a Comment