Mail Archives: djgpp/1997/11/07/07:53:29
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".
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.
Do you folks can devise a simple method to check if the script is being run
from COMMAND.COM or spawned from a djgpp program?
TIA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak E-mail: csrabak AT ipt DOT br
DME/ASC Phone: 55-11-268-3522 Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax: 55-11-268-5996
Av. Prof. Almeida Prado, 532. Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Raw text -