There are lots of BAT scripts in the distribution's bin\ directory.
They mostly (or exclusively) contain a copy of the homonymous Perl
script, plus the following:

C:\Opt\Perl512.32\bin :: diff pwhich pwhich.bat
0a1,12
> @rem = '--*-Perl-*--
> @echo off
> if "%OS%" == "Windows_NT" goto WinNT
> perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
> goto endofperl
> :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
> @rem ';
1a14
> #line 15
141a155,157
>
> __END__
> :endofperl

(Useful script, by the way - try "pwhich -a perl" to see all perls.)

My question is:

Do the BAT scripts contain a copy of the Perl script to be backward-
compatible with some old version of cmd.exe ? Because at least with a
current cmd.exe you could simply do the following to call Perl with a
script of the same name as the BAT file (like foo.bat -> foo.pl):

  @CALL %~dp0perl.exe %~dpn0.pl

Or just:

  @CALL perl.exe %~dpn0.pl

Which would use (I think) a perl.exe installed in the same directory as
the BAT script.

See "CALL /?" in cmd.exe . I'm using this feature a lot since I've
discovered it.

Michael
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to