BEGIN { my $path=$0; $path=~s{[^\/]+$}{libs/}; } use lib $path;
The "minor" problem with this is that the lexical $path will already be out of scope in the use lib $path; statement (so the (empty) global $path is being used instead...)
Moving the my $path; before the BEGIN block does work, though.
(Honestly, I'm somewhat surprised it does (you might argue the BEGIN block is being executed before the lexical is brought into existence - but apparently this is not the case...). Would any of the more knowledgable Monks care to comment on whether this is a feature you can rely on?)
In reply to Re^2: problem with paths to library files
by almut
in thread problem with paths to library files
by j_c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |