home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5303 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.5 KB  |  46 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!gatech!destroyer!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!namao!jboeske
  3. From: jboeske@namao.uucp (John Boeske)
  4. Subject: Re: #! Emulation in MSDOS
  5. Message-ID: <jboeske.713740843@namao>
  6. Sender: news@kakwa.ucs.ualberta.ca
  7. Nntp-Posting-Host: namao.ucs.ualberta.ca
  8. Organization: University Of Alberta, Edmonton Canada
  9. References: <1992Aug13.044323.1094@silogic.uucp> <1992Aug13.132107.24139@doc.ic.ac.uk>
  10. Date: Thu, 13 Aug 1992 21:20:43 GMT
  11. Lines: 33
  12.  
  13. >In a recent posting, I saw a reference to #! emulation in MSDOS.  The
  14. >posting showed a code fragment which was to be place at the front of the
  15. >file:
  16. >@REM=(qq!
  17. >@echo off
  18. >perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  19. >@goto end :) if 0;
  20. >After trying this, it became obvious that a line or two is required at
  21. >the end of the file after the Perl code.  I'm not versed enough in Perl
  22. >to figure out the lines at the end. 
  23.  
  24. I have the following file, _.bat in my path:
  25. ----------------------- _.bat -----------------------
  26. @echo off
  27. if not "%1"=="#" goto EXIT
  28. shift
  29. shift
  30. shift
  31. perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  32. :EXIT
  33.  
  34. and I start my perl scripts with
  35. ---------------------- hello.bat ---------------------
  36. @_; # perl %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
  37. print "JADPH\n";
  38.  
  39.  
  40. This seems simpler to me, but I can't easily put -w's and the like in
  41. the perl script.  And I haven't yet explicitly put . in my PATH, so I
  42. have to make sure that my scripts are in my PATH.  But I'm happy anyway.
  43.  
  44. John Boeske                 System Software, CNS, University of Alberta
  45. jboeske@namao.ucs.ualberta.ca
  46.