Managing PERL5LIB with multiple perl installation

  • Thread starter Jahagirdar Vijayvithal S
  • Start date
J

Jahagirdar Vijayvithal S

The default global installation of perl here is 5.005_03

I have installed v5.8.4 locally as a higher version was needed for some
of the modules i am using.

Now I need to constantly switch the value of PERL5LIB enviornment
variable depending on wether I am using my local scripts or scripts
developed by others . Is there a way to automate this without changing
my perl scripts?

Regards
Jahagirdar Vijayvithal S
 
J

John Bokma

Jahagirdar said:
The default global installation of perl here is 5.005_03

I have installed v5.8.4 locally as a higher version was needed for some
of the modules i am using.

Now I need to constantly switch the value of PERL5LIB enviornment
variable depending on wether I am using my local scripts or scripts
developed by others . Is there a way to automate this without changing
my perl scripts?

What breaks under 5.8.4?
 
B

Ben Morrow

Quoth $HOME:
The default global installation of perl here is 5.005_03

I have installed v5.8.4 locally as a higher version was needed for some
of the modules i am using.

Now I need to constantly switch the value of PERL5LIB enviornment
variable depending on wether I am using my local scripts or scripts
developed by others . Is there a way to automate this without changing
my perl scripts?

Write a module which checks $] and sets @INC to the approriate thing[1],
and put e.g. -MLocal::MyINC in PERL5OPT.

[1] use lib rather than explicitly setting @INC, as it deals with
finding the right arch-specific directory as well.

Ben
 
B

Big and Blue

Jahagirdar said:
The default global installation of perl here is 5.005_03

I have installed v5.8.4 locally as a higher version was needed for some
of the modules i am using.

Now I need to constantly switch the value of PERL5LIB enviornment
variable depending on wether I am using my local scripts or scripts
developed by others .

One of the perils of relying on your GLOBAL environment settings for
data which are application specific. (This doesn't just apply to PERL5LIB
- global settings of things such as LD_LIBRARY_PATH are equally pernicious).

Write an interlude (for *both* perls if necessary) which sets the
relevant PERL5LIB for each before exec'ing the real perl executable (or
write modules and prepend a -M.... arg before those passed on before
exec'ing). Then use those interludes to free yourself from environmental
pollution.
 
J

Jahagirdar Vijayvithal S

* Ben Morrow said:
Quoth $HOME:
The default global installation of perl here is 5.005_03

I have installed v5.8.4 locally as a higher version was needed for some
of the modules i am using.

Now I need to constantly switch the value of PERL5LIB enviornment
variable depending on wether I am using my local scripts or scripts
developed by others . Is there a way to automate this without changing
my perl scripts?

Write a module which checks $] and sets @INC to the approriate thing[1],
and put e.g. -MLocal::MyINC in PERL5OPT.

This seems to fail when I do something like
perl -d:ptkdb <script>
My guess would be that the above command tries to first load ptkdb
followed by MyINC.
[1] use lib rather than explicitly setting @INC, as it deals with
finding the right arch-specific directory as well.

Ben
 
J

Jahagirdar Vijayvithal S

* Big and Blue said:
Write an interlude (for *both* perls if necessary) which sets the
relevant PERL5LIB for each before exec'ing the real perl executable (or
write modules and prepend a -M.... arg before those passed on before
exec'ing). Then use those interludes to free yourself from environmental
pollution.
I am not sure what an interlude is. can you please elaborate on it?
Regards
Jahagirdar Vijayvithal S
 
B

Ben Morrow

Quoth $HOME:
I am not sure what an interlude is. can you please elaborate on it?

A more usual (or perhaps simply more modern?) term would be 'shell
script' or 'batch file', depending on OS.

Ben
 
A

Arndt Jonasson

Ben Morrow said:
Quoth $HOME:

A more usual (or perhaps simply more modern?) term would be 'shell
script' or 'batch file', depending on OS.

Another term in common use is 'wrapper'. Exactly what it wraps depends
on context, of course - you can have wrapper functions too. The term
"interlude" was new to me - a dejanews search on comp.* gives me 52
hits for "interlude AND script" and 15000 for "wrapper AND script".

Outside the programming world, "interlude" has to do with music.
 
J

Jahagirdar Vijayvithal S

* Ben Morrow said:
A more usual (or perhaps simply more modern?) term would be 'shell
script' or 'batch file', depending on OS.

Ben
Thanks, shell scripts and wrappers I am familiar with.
Regards
Jahagirdar Vijayvithal S
 
B

Big and Blue

Ben said:
A more usual (or perhaps simply more modern?) term would be 'shell
script' or 'batch file', depending on OS.

Which would be wrong if the interlude were, in fact a C program.

An interlude is anything which comes between what you and what you
finally end up running. The intend is to do something consistent/useful for
you without you needing to think about it. Particularly useful in
multi-user, multi-application environments when this interlude can be
maintained by the individual application maintainer to do-the-right-thing
and hence avoid requiring users to do things, or worry about
inter-application problems when setting things such as PERL5LIB or
LD_LIBRARY_PATH for specific applications (and perl is just an application
in this sense).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top