BaseLib

 view release on metacpan or  search on metacpan

docs/BaseLib-example1  view on Meta::CPAN


SH] 
SH] or, you can use colon-separated path (like Unix's
SH] PATH) to let you include several directories:
SH] 
SH]   BEGIN {
SH]     for(split/:/,$ENV{PROJLIBDIR}) { use lib $_; }
SH]   }
SH] 
SH] your scripts can also refuse to run if PROJLIBDIR
SH] is not defined or looks suspicious.
SH] 
SH]   BEGIN {
SH]     for($ENV{PROJLIBDIR}){
SH]       croak "PROJLIBDIR is not defined!" unless defined;
SH]       ($_)=/(.*)/; # untaint like crazy
SH]       use lib $_;
SH]   }

Well, that's too much for the script. Besides, you missed
one bracket :-)

docs/BaseLib-example2  view on Meta::CPAN

SH] switch versions. in addition it works with -T because it
SH] doesn't rely on the environment.

That's what I avoid. But there's still a tainted data, that's
the full path to script directory from FindBin. That's why
the data needs to be untainted first.


SH] so BaseLib-based scripts basically first uses FindBin to
SH] find itself, but then, instead of using relative path to
SH] connect to its LIBDIR, it looks for LIBDIR in its own
SH] path, because it must be there! (well, as long as LIBDIR
SH] is specified correctly). simple, but clever. now why
SH] hadn't the rest of us thought of that before? :-)

Yes, there must be some convention here. Both BASEDIR and
LIBDIR must be rather static. That's why I said (in my
answer in clp.misc), when those variable change, that's
a different level of decision. It of course affects the
usage of BaseLib.



( run in 0.469 second using v1.01-cache-2.11-cpan-607d282f910 )