Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://242991]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-02-25 00:38 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (312 votes). Check out past polls.