Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: portable "#!" line?

by dsheroh (Prior)
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.

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2018-05-27 20:08 GMT
Find Nodes?
    Voting Booth?