http://qs321.pair.com?node_id=1002403


in reply to use lib in cgi env

I have a common little snippet I drop at the top of a lot of projects, to set use lookup paths relative to the running binary.

my $rundir; BEGIN { use File::Basename; $rundir = dirname($0); } use lib "$rundir/lib";

Then you can have

/any/old/random/place/script.pl /any/old/random/place/lib/Foo.pm

and just use Foo, relocating the whole project at will. Obviously not perfect against the case of you running the script via alternate hardlinks or such, but...