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

use lib \"SCRIPTDIR"

Thread Next
Jenda Krynicky
March 29, 2001 10:16
use lib \"SCRIPTDIR"
Message ID:
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 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 to 
work, but at last we could have a PROPER version that would actually 
work. And an easy answer even for newbees.


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

== == ==
: What do people think?
What, do people think?  :-)
             -- Larry Wall in <>

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About