in reply to Re: Referring to a module above the CWD
in thread Referring to a module above the CWD

Later in this thread, Spidy, you say you want #2, but if someone else reading this wants the answer to #1, the "FindBin" module comes in handy.

E.g. suppose you have a top directory, and underneath it you have bin and lib, and under lib you have your modules. You could use:
use FindBin qw($RealBin); use lib ("$RealBin/../lib");
To access your modules.

In this case, $RealBin will be set to the directory of your script, and if you have a set way to navigate to your libraries from that directory, you can make use of that.

This technique can be useful, for example, if you have multiple versions of an application + set of libraries around, and want them both to be installed at the same time without version conflicts.


--JAS

Replies are listed 'Best First'.
Re^3: Referring to a module above the CWD
by merlyn (Sage) on Jun 17, 2007 at 16:16 UTC