in reply to use lib qw(relative path)

What about using the PERL5LIB environment variable? You wouldn't have to worry about doing use lib. You could do something like this to run your script:

PERL5LIB=/path/lib;export PERL5LIB;/path/yourscript.pl

Or you could do a shell script that would do that for you.

---
-Andrés Monroy-Hernández

Replies are listed 'Best First'.
Re^2: use lib qw(relative path)
by amonroy (Scribe) on Sep 25, 2004 at 21:48 UTC

    Another thing you could try is:

    BEGIN{ use File::Basename; use File::Spec; my $dir = File::Spec->rel2abs(dirname($0)); die "Cannot relocate '$dir'.\n" unless(chdir($dir)); } use lib './lib';

    Regards,
    --
    -Andrés Monroy-Hernández