http://www.perlmonks.org?node_id=979393


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