• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

using specific perl version

Situation: I had perl 5.8 installed on my linux box, while upgrading it installed perl in
#! /usr/local/bin/perl

but i still have my old perl 5.8 inside
#! /usr/bin/perl

Now i have installed some new perl modules and all gone unders /usr/local/bin/perl

so when i use the following
#! /usr/bin/perl
#! /usr/local/bin/perl

in my perl scripts it looks at the old perl and prompt me that some modules not there. but it's there in the new location!

For the moment, i have the second line as first line... so it's Working!!! but i don't like this way as i have to put the same script  on many site and all sites running the following as first two lines...
#! /usr/bin/perl
#! /usr/local/bin/perl
Now i think the solution would be setting my linux /apache to use the other path for perl, how can i ?

I hope i have cleared  my situation...

Any solution fixing this issue in style will be accepted.

0
str_kani
Asked:
str_kani
  • 5
  • 3
  • 2
1 Solution
 
cjl7Commented:
Hi,

You can set the path of the lib you want to use...

 use lib LIST;

or

use lib "/usr/local/lib";


Cheers

Jonas
0
 
str_kaniAuthor Commented:
i am new this! can you please tell me where to set this? in the cgi-perl code?

i prefer something to set in the linux machine or apache, because i will not be able to change the code on the development and productions versions, i need to move the dev version to the production. So if i change something in the code for matching my dev enviroment it will affect the production environment also....
0
 
cjl7Commented:
Sorry,

Yes, you put this in the perl-script that you are running...

the first two lines would look something like this...

#!/usr/local/bin/perl
use lib "/usr/local/lib"
...


// jonas
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
str_kaniAuthor Commented:
that's what i have done... but i don't like this way as i have to put the same script  on many site and all sites running the following as first two lines...
#! /usr/bin/perl
#! /usr/local/bin/perl
Now i think the solution would be setting my linux /apache to use the other path for perl, how can i ? I am not interested in an option changing anything in perl script. Please prefer something that can be done through the apache server settings... so that i can use the same script on the demo and productions.

1) is there any way we can switch the updates perl to the path where the current perl running?
0
 
ahoffmannCommented:
how about following on your system:

mv /usr/bin/perl{,-old}
ln -s /usr/local/bin/perl /usr/bin/perl

then you can leave your hashbang line as

#! /usr/bin/perl
0
 
str_kaniAuthor Commented:
can you please tell me what exatcly this will do? and do you really think this will fix the issue? [I am quite new to linux, so please bear with me]
0
 
ahoffmannCommented:
it moves your old perl executable and then makes a symlink to the new executable in place of you old path
then each usage of your old path (/usr/bin/perl) executes the new installed perl (/usr/local/bin/perl), you don't need to change your hashbang lines anymore
0
 
str_kaniAuthor Commented:
Wow, that did that!!!
does this linking last long for ever? or may reset during machine reboot?
0
 
ahoffmannCommented:
no, it's permanent (except you have a special boot script which would change it, which is unusal)
0
 
str_kaniAuthor Commented:
ok, thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now