in reply to Re^2: use lib qw(relative path)
in thread use lib qw(relative path)
I don't know whether your algorithm itself can be written in another way to make it better do FindBin's job, but you can make your algorithm more portable.
If you want it to be portable you probably want to use File::Basename. Also, &File::Basename::dirname takes care of the special case of the argument being just a file with not directory in it, and returning ".". To continue being portable, use catfile instead of joining then strings with a slash.
use File::Basename qw/ dirname basename /; use File::Spec::Functions qw/ catfile /; BEGIN { $Bin = dirname($0); $Script = basename($0); $Lib = catfile($Bin, 'lib'); } use lib $Lib;
ihb
Read argumentation in its context!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: use lib qw(relative path)
by ccn (Vicar) on Sep 26, 2004 at 10:28 UTC |