Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

use lib
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


Report this thread to moderator Post Follow-up to this message
Old Post
B. Fongo
03-27-04 04:14 AM


Re: use lib
From: "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


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
03-27-04 04:14 AM


RE: use lib
B. 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';

Report this thread to moderator Post Follow-up to this message
Old Post
Bob Showalter
03-27-04 04:14 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:52 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.