Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
P is for Practical
 
PerlMonks  

Re: #!$var/bin/perl

by hawtin (Prior)
on Mar 14, 2003 at 10:04 UTC ( #242991=note: print w/ replies, xml ) Need Help??


in reply to #!$var/bin/perl

One option that I haven't yet seen mentioned is the /bin/env trick. If your first line is

#!/bin/env perl

The system will find the perl on your path and use that. This trick was used quite a lot when standard installations did not include Perl since it allowed "non-root" users to install local copies of Perl. It allows the different systems to have different locations for the perl installation and manages to work out everything for you.

The only difficulties are:

  • Security (already covered)
  • Some *NIX systems put the env program somewhere other than /bin (/usr/bin/env is quite common, you could add a symbolic link on those machines?)

Having something that modifies your scripts for different locations is often a bad idea (one of the great things about Perl is that it is portable). When distributing scripts you really don't want to have to edit the script to make it function (like when sending to naïve users).


Comment on Re: #!$var/bin/perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://242991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (16)
As of 2014-04-18 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (471 votes), past polls