Code Comments
Programming Forum and web based access to our favorite programming groups.Is it recommendable to use the pragma "use lib " when installing a program on a server shared by many users? Assuming my IPS did not install certain CPAN modules which my needs, and I decide to install them in my www directory. In such a scenario, putting "use lib" on my scripts will add my module directory to @INC - which in fact isn't desired. How can I avoid this situation? Babs
Post Follow-up to this messageFrom: "B. Fongo" <perl@fongo.de>
> Is it recommendable to use the pragma "use lib " when installing a
> program on a server shared by many users? Assuming my IPS did not
> install certain CPAN modules which my needs, and I decide to install
> them in my www directory. In such a scenario, putting "use lib" on my
> scripts will add my module directory to @INC - which in fact isn't
> desired.
1) not sure how do you have this setup, but the directory containing
the modules should not be accessible via web
2) having a
use lib 'something';
in a script affects @INC just for this script. Which in fact is
desired. You need to do so, otherwise the modules would not be found.
You may remove the directory from the @INC after you import the
modules with
BEGIN {shift(@INC)};
(assuming you are sure the directory was NOT present in @INC before!)
but I do not see any reason to do so.
Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
Post Follow-up to this messageB. Fongo wrote: > Is it recommendable to use the pragma "use lib " when installing a > program on a server shared by many users? > Assuming my IPS did not install certain CPAN modules which my needs, > and I decide to install them in my www directory. > In such a scenario, putting "use lib" on my scripts will add my module > directory to @INC - which in fact isn't desired. This is only an issue under mod_perl, where @INC persists across requests and would thus be shared by multiple scripts. Under mod_cgi, the changes made by "use lib" affect only the current process's copy of @INC, so there's nothing to be concerned about. > > How can I avoid this situation? You could try something like this if you're running under mod_perl: use lib '/my/lib/path'; use MyModule; no lib '/my/lib/path';
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.