Mail Archives: djgpp/1997/11/11/08:00:19
> Darryl Okahata (darrylo AT sr DOT hp DOT com) suggests that to have a Perl script run
> as a executable under M$-DOG the following be added to the script and rename
> its extension to .BAT
>
> @echo off
> perl -x -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
> goto endofperl
> #! c:/djgpp/bin/perl
> # The previous comment is REQUIRED! This comment, and the following
> # ones, can be deleted.
> # Insert your perl script here. Your perl script goes here, and only
> # here.
> __END__
> :endofperl
>
> This works well for standalone scripts, however if any script calls another
> modified as above, due the way djgpp lib globs the %0 argument, Perl fails
> due the attempt to run "script.bat.bat" instead of "script.bat".
There are two other solutions in the perl source distribution: look at the
win32/bin directory.
> The only trivial way to circumvent this I arrived at is to leave the perl
> script pristine and to create a companion .BAT file containing just a line:
>
> perl -x -S script %1 %2 %3 %4 %5 %6 %7 %8 %9
>
> but it is cumbersome, wastes disk and easy to make mistakes.
I don't like .bat wrappers, because redirection doesn't work. You may try
to use use a cleverer doskey (like wced), so you can use aliases with
command.com.
Or you can try bash ;-)
Laszlo
- Raw text -