So, my code (Perl scripts and Perl modules) sits in a tree:
trunk/
util/
process/
scripts/
There are utilities in the 'util' directory that are needed in the 'process /' dir. They are accessed as follows:
use FindBin;
use lib "$FindBin::Bin/../util";
use UtilityModule qw(all);
This construct does not care about where you start while you are at the same level in the tree as util /.
But I decided that the “scripts /” are full, so I created
scripts/scripts1
scripts/scripts2
Now I see that this does not work. If I run the script 'trunk / scripts / scripts1 / call_script.pl' and it calls '/trunk/process/process_script.pl' then "process_script.pl" will not be able to execute the procedures from UtilityModule (), because the path that FindBin returns - this is the path to the top-level script call.
, , - :
use lib $path_that_came_from_elsewhere;
, Perl , FindBin.
, BEGIN {}, , , , , . - , !