My Perl script runs under several OS’s, including unix and Win32. On every OS there is unique Perl setup, whereby the perl interpreter is located under different directories.
Is there a way to specify the interpreter on the shebang line like:
#!which perl
Install your scripts with the normal CPAN tools. During the build, they take the perl that you used to run the build script and inserts it into the shebang line. Also, you’ll ensure that the perl you are using has the dependencies installed.
For instance, you have at the top of your script:
Using the normal module distribution process (see my App::PPI::Dumper as an example),
Installing it, ExtUtils::Makemaker or Module::Build rewrites the shebang with the path of the perl you used with the build script:
When you distribute your script as a complete distribution, you get all of the toolchain features for free, like automatic installation of dependencies. It makes life much easier.