develooper Front page | perl.perl5.porters | Postings from June 2015

Re: Batch file generation for installed scripts on Windows

Thread Previous
Leon Timmermans
June 2, 2015 14:04
Re: Batch file generation for installed scripts on Windows
Message ID:
On Tue, Jun 2, 2015 at 2:17 PM, A. Sinan Unur <> wrote:

> I am wondering exactly where the batch files for installed scripts are
> generated on Windows.
> I try to keep a variety of Perl installations, and use one as my main
> one. Usually, switching between those end up involving having to
> prepend my %PATH% with the appropriate Perl bin locations even if I
> invoke the scripts using their full paths. E.g.:
> C:\> c:\opt\perl-5.22.0\bin\corelist.bat
> 'perl' is not recognized as an internal or external command,
> operable program or batch file.
> You do not have Perl in your PATH.
> This is because of the standard preamble:
> :WinNT
> perl -x -S %0 %*
> if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
> if %errorlevel% == 9009 echo You do not have Perl in your PATH.
> if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
> goto endofperl
> I do not see if any problems would be caused by actually not relying
> on perl being in %PATH% and instead writing the absolute path to perl
> in the batch file as in
> c:\opt\perl-5.22.0\bin\perl -x -S %0 %*
> As far as I can tell, all this requires is to use $^X instead of perl
> in win32\bin\pl2bat.bat.
> Are there any pitfalls I am not seeing?

Currently there are three implementations of this logic. The first is
pl2bat (used by MakeMaker and core build), the second is a fork of the
first in Module::Build (some divergence may have happened), and the third
is a fork of the second in ExtUtils::Helpers (used by Module::Build::Tiny).

Before changing how any of this works, we should maybe have one unified
module in core that acts as the backend for all of them. If we are updating
the beast, maybe we should drop Win9x support too ;-)


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About