delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/07/07:53:29

Message-Id: <1.5.4.32.19971107125140.006ba23c@dce03.ipt.br>
Mime-Version: 1.0
Date: Fri, 07 Nov 1997 10:51:40 -0200
To: djgpp AT delorie DOT com
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Perl 5.004_02 -

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019