Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: portable "#!" line?

by dsheroh (Parson)
on Jul 02, 2012 at 08:35 UTC ( #979393=note: print w/ replies, xml ) Need Help??


in reply to portable "#!" line?

Within the code itself, the usual recommendation is to use

#!/usr/bin/env perl
This will cause it to run using the first perl found in the executing user's $PATH.


Comment on Re: portable "#!" line?
Select or Download Code
Re^2: portable "#!" line?
by llancet (Friar) on Jul 02, 2012 at 13:17 UTC
    The "env perl" probably won't provide what I want, as it provides the first perl binary found in a series of dirs, but what I want is the location of installer's binary.

      First off, which OS do you and your colleagues use? The majority of my perl XP comes from OS X and linux, so if you are using Windows, I don't know if the following will help at all.

      I use perlbrew and #!/usr/bin/env perl always works for me. If using perlbrew is impractical, why not add the desired perl install to the beginning of the $PATH. It seems like this should always be the case and if it isn't, the user will be overriding the #! anyway if they directly call the perl they want to use.

Re^2: portable "#!" line?
by DrHyde (Prior) on Jul 03, 2012 at 11:07 UTC
    #!/usr/bin/env perl is not portable. Some more exotic systems have /bin/env instead. The correct solution, as already stated by another monk, is #!perl and let ExtUtils::MakeMaker sort it out for you.
      What if I don't use Extutil::MakeMaker? I get used to Module::Build.

        What if I don't use Extutil::MakeMaker? I get used to Module::Build.

        T.I.T.S - Try It To See

        Although I doubt Module::Build would mess this up

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-08-28 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (259 votes), past polls