develooper Front page | perl.perl5.porters | Postings from March 2001

use lib \"SCRIPTDIR"

Thread Next
From:
Jenda Krynicky
Date:
March 29, 2001 10:16
Subject:
use lib \"SCRIPTDIR"
Message ID:
5FA3BCC600F8@amber.zine.cz
I'd have a small suggestion.

Quite often people ask how to install a script with its modules 
without adding files to the common libraries (usually because they do 
not have permissions to do that ;-)

I've seen several code snipets that add for example the directory 
where the script resides to @INC, usually not portable and always 
tedious to add to all scripts. 

What about extending use lib to do things like that for you?

You can't safely do this :

 use lib "SCRIPTDIR";

Even though it's unlikely, the programmer might have wanted to add a 
directory "SCRIPTDIR" added into @INC.

So to make sure the new lib.pm works the same for old scripts we
might use this syntax  :

 use lib \"SCRIPTDIR";

Notice the backslash !

Of course the scripts would require the new version of lib.pm to 
work, but at last we could have a PROPER version that would actually 
work. And an easy answer even for newbees.

Jenda

P.S.: It would be nice if we could do even use lib \"SCRIPTDIR/lib";

== Jenda@Krynicky.cz == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
             -- Larry Wall in <199808071736.KAA12738@wall.org>

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About