andre@targon.UUCP (andre) (05/03/91)
Now that we have perl also running on msdos, I thought up a way to put
perl script inside msdos batch files in the same way we do in sh scripts.
What I use is a "header" and a "trailer" to wrap the perl script in:
----Cut Here put in hello.bat ----
@echo = off ;
@rem = " MSDOS TO PERL STARTUP LINE
perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
goto :end
" if (0);
##### Perl script #####
print "Hello world\n";
while (<>) {
print "input: $_ \n";
}
@rem = " MSDOS TO PERL STARTUP LINE
:end
rem ";
----Cut Here----
My question is, do you see problems with this solution?
Has it been done earlier?
Can it be done better or more elegant? (this works on msdos 3.3
script must be in your path, not just .)
Happy perling,
--
The mail| AAA DDDD It's not the kill, but the thrill of the chase.
demon...| AA AAvv vvDD DD Ketchup is a vegetable.
hits!.@&| AAAAAAAvv vvDD DD {nixbur|nixtor}!adalen.via
--more--| AAA AAAvvvDDDDDD Andre van Dalen, uunet!hp4nl!targon!andre
roy%cybrspc@cs.umn.edu (Roy M. Silvernail) (05/05/91)
andre@targon.UUCP (andre) writes: > Now that we have perl also running on msdos, I thought up a way to put > perl script inside msdos batch files in the same way we do in sh scripts. > > My question is, do you see problems with this solution? > Has it been done earlier? > Can it be done better or more elegant? (this works on msdos 3.3 > script must be in your path, not just .) Elegance, you say? Certainly, you can do it more elegantly... just use 4dos for your command interpreter, and do 'set .pl=c:\path\to\perl'. Now, any filename ending in .pl will be submitted to perl. (the usual rejoinder about the natural superiority of 4dos over command.com has been deleted, since this isn't a DOS-specific group :-) -- Roy M. Silvernail -- roy%cybrspc@cs.umn.edu - OR- cybrspc!roy@cs.umn.edu perl -e '$x = 1/20; print "Just my \$$x! (adjusted for inflation)\n"' [space reserved for clever quote]{mail your submissions}
andre@targon.UUCP (andre) (05/08/91)
In article <gsTg22w164w@cybrspc> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes: >andre@targon.UUCP (andre) writes: >> Now that we have perl also running on msdos, I thought up a way to put >> perl script inside msdos batch files in the same way we do in sh scripts. >> Can it be done better or more elegant? (this works on msdos 3.3 >> script must be in your path, not just .) >Elegance, you say? Certainly, you can do it more elegantly... just use >4dos for your command interpreter, and do 'set .pl=c:\path\to\perl'. >Now, any filename ending in .pl will be submitted to perl. Will this also handle the optional flags that you five to perl like -e or -s ? And what about arguments ? I would like to get a msdos equivalent to the /bin/sh trick, just saying use another shell won't work for us, we use msdos (regretfully) and yes I know... the batch file that I now use is not elegant hence my question. -- The mail| AAA DDDD It's not the kill, but the thrill of the chase. demon...| AA AAvv vvDD DD Ketchup is a vegetable. hits!.@&| AAAAAAAvv vvDD DD {nixbur|nixtor}!adalen.via --more--| AAA AAAvvvDDDDDD Andre van Dalen, uunet!hp4nl!targon!andre
wnp@iiasa.AT (Wolf PAUL) (05/08/91)
andre@targon.UUCP (andre) writes:
) Now that we have perl also running on msdos, I thought up a way to put
) perl script inside msdos batch files in the same way we do in sh scripts.
) What I use is a "header" and a "trailer" to wrap the perl script in:
) <code deleted>
) My question is, do you see problems with this solution?
Other than a lot of typing, no :-)
) Has it been done earlier?
I believe I have seen something like this earlier ...
) Can it be done better or more elegant? (this works on msdos 3.3
) script must be in your path, not just .)
Well, the most elegant way no doubt is to get 4DOS, a shareware replacement
for COMMAND.COM selling for less than US$ 50 (registered version).
It will let you say "set .pl=c:\bin\perl.exe", and will then automatically
hand files with the extension ".pl" to c:\bin\perl to execute.
That, in fact, is one feature I highly recommend to MS and DR for
addition to their MS-DOS 5.x and DR-DOS products.
--
W.N.Paul, Int. Institute f. Applied Systems Analysis, A-2361 Laxenburg--Austria
PHONE: +43-2236-71521-465 INTERNET: wnp@iiasa.iiasa.ac.at
FAX: +43-2236-71313 UUCP: uunet!iiasa!wnp
HOME: +43-2236-618514 BITNET: tuvie!iiasa!wnp@aearn.BITNET