Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Specifying multiple perl interpreters for a script

Reply
Thread Tools

Specifying multiple perl interpreters for a script

 
 
Yash
Guest
Posts: n/a
 
      07-13-2004
In our perl scripts, we give the path to the perl interpreter on the
first line of the script as :
#!/usr/bin/perl

But our customers sometimes have perl installed in some other place
such as /opt/perl/bin/perl or /usr/local/bin/perl

Is there a way to specify all such possible paths and make sure the
one that exists gets used?

This is so that no change needs to be done at the customer's end.

Thanks
 
Reply With Quote
 
 
 
 
mr.happy
Guest
Posts: n/a
 
      07-13-2004
On Tue, 13 Jul 2004 06:39:11 -0700, Yash wrote:

> But our customers sometimes have perl installed in some other place such
> as /opt/perl/bin/perl or /usr/local/bin/perl
>
> Is there a way to specify all such possible paths and make sure the one
> that exists gets used?


'env' can be used for this:

env(1) is often used with the #!-mechanism to start an interpreter, which
then only needs to be somewhere in your PATH, e.g. "#!/usr/bin/env perl".

However, env(1) is not /usr/bin/env but /bin/env on OpenServer 5 and on a
very few Linux older distributions. Free-, Net- and OpenBSD in turn only
come with /usr/bin/env. So the env-mechanism is increasing convenience,
but not really assuring portability.

http://www.in-ulm.de/~mascheck/various/shebang/

greets,
-- dirk
You will be run over by a beer truck.
 
Reply With Quote
 
 
 
 
svenne
Guest
Posts: n/a
 
      07-13-2004
Yash wrote:

> #!/usr/bin/perl

remove the path in the shebang line and add the path to your PATH env var.
/G
--
--
www.gh-webinteractive.com

 
Reply With Quote
 
Peter Scott
Guest
Posts: n/a
 
      07-14-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) (Yash) writes:
>In our perl scripts, we give the path to the perl interpreter on the
>first line of the script as :
>#!/usr/bin/perl
>
>But our customers sometimes have perl installed in some other place
>such as /opt/perl/bin/perl or /usr/local/bin/perl
>
>Is there a way to specify all such possible paths and make sure the
>one that exists gets used?


If you subscribe to The Perl Journal, you'll find an article in
the April 2003 issue (http://www.tpj.com/archives/0304/) covering
exactly that. The mother of all shebang lines, you might say.

--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
several interpreters and suspend script Mike Python 0 10-24-2005 09:10 AM
Multiple Interpreters In a Single Thread bmatt Python 2 09-29-2004 11:07 AM
Looking for advice: supporting multiple embedded interpreters Paul Miller Python 4 01-23-2004 03:20 PM
Multiple interpreters in a single process Maciej Sobczak Python 1 01-14-2004 04:38 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments