delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/11/08:00:19

From: molnarl AT cdata DOT tvnet DOT hu
Date: Tue, 11 Nov 1997 13:58:56 +0100 (MET)
Reply-To: molnarl AT cdata DOT tvnet DOT hu
To: djgpp AT delorie DOT com
Subject: Re: Perl 5.004_02 -
In-Reply-To: <199711111235.NAA17993@ural2.hszk.bme.hu>
Message-ID: <Pine.SOL.3.95.971111135336.318C-100000@dumballah.tvnet.hu>
MIME-Version: 1.0

> 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 -


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