Hi,

I would like to register a module with the following listing entry,

Name     Description                      DSLI  Info
------------------------------------------------------
BaseLib  manipulate @INC dynamically for  adpf  HASANT
         independent installation layout


Introduction

BaseLib includes a private library path belongs to a certain *application
directory tree* to @INC. So, when a script says,

    use BaseLib qw(BASEDIR LIBDIR);

it always refers to `/path/to/BASEDIR/LIBDIR wherever the script is run
from, as long as BASEDIR and LIBDIR remain unchanged. `/path/to' can be
arbitrary installation/deployment path where BASEDIR is put under.

So there's no need to change use() statement when the whole directory
tree moves to somewhere else, say, `/newpath/to/BASEDIR/LIBDIR'. Using
lib.pm requires the scripts to be modified the use statement from,

    use '/path/to/BASEDIR/LIBDIR';

to

    use '/newpath/to/BASEDIR/LIBDIR';

By using BaseLib, no need to change anything. The statement,

    use BaseLib qw(BASEDIR LIBDIR);

will automatically points to '/newpath/to/BASEDIR/LIBDIR'.

I know there are many alternatives to this way, such as environment
variables (PERL5LIB, PERLLIB, or any custome ones), and the standard
lib.pm. I have some examples and comparison that shows the advantage of
using BaseLib over the other alternatives at,

    http://202.159.35.69/~san/perl/modules/BaseLib.example1

should anyone interested. The module package itself is at,

    http://202.159.35.69/~san/perl/modules/BaseLib-0.03.tar.gz


Discussion

I've discussed this module at clp.misc and bandung.pm.org mailing
list (local PM group). Folks at the NG tended to provide other
solutions which none of them fulfilled my need. I got two responds
in the milist. One offered the usage of ENV. But soon after I pointed
out the weakness, he accepted the BaseLib solution. Another responder
has even tested the module and reported that it worked.


Does the namespace fit? Is it OK to upload it to PAUSE?


TIA
san
-- 
trabasLabs * [EMAIL PROTECTED] * http://www.trabas.com


Reply via email to