home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7720 < prev    next >
Encoding:
Text File  |  1993-01-08  |  3.5 KB  |  81 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!world!aml
  3. From: aml@world.std.com (Andrew M Langmead)
  4. Subject: Re: *sigh* Yes, the eternal question: How do I run it under 4dos aga
  5. Message-ID: <C0Jq2p.FDD@world.std.com>
  6. Organization: The World @ Software Tool & Die
  7. References: <kenc.725847059@sol> <0L1PwB5w165w@cybrspc.UUCP> <1267@alsys1.aecom.yu.edu>
  8. Date: Fri, 8 Jan 1993 17:32:49 GMT
  9. Lines: 70
  10.  
  11. manaster@yu1.yu.edu (Chaim Manaster) writes:
  12.  
  13. >In article <0L1PwB5w165w@cybrspc.UUCP> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:
  14. >>
  15. >>Not in the .ini, but in autoexec.bat, put
  16. >>
  17. >>set .pl=c:\where\ever\perl.exe
  18. >>
  19. >>Works for me.  For command line flags, put 'em in the #!/usr/bin/perl
  20. >>line at the beginning of the script.
  21. >>--
  22.  
  23. >Could you provide an example of  using the command line flags and
  24. >how they go into the #!/usr/bin/perl line when using 4dos. Also
  25. >what would the actual command line inokation be? Also is there a
  26. >difference between "flags" and file parameters on the command line?
  27.  
  28. The 4DOS command processor, when looking for a file to execute, besides
  29. looking for files with .COM, .EXE, .BAT, and .BTM (4DOS fast batch files)
  30. also certain user defined "executable extentions." The user defines
  31. an executable extentions with a SET command like above. This tells
  32. 4DOS that if an user types FOO at the command prompt, and there isn't
  33. a FOO.COM, FOO.EXE, FOO.BAT, or FOO.BTM, that it should then look for
  34. a FOO.PL file. If it finds FOO.PL it will execute it be running the
  35. command C:\WHERE\EVER\PERL.EXE FOO.BTM
  36.  
  37. >I also don't quite understand the logic here? Isn't the # sign the
  38. >comment marker in DOS, so how is anything on that line actually
  39. >used? Also in DOS it is the \ rather than the / that demarks
  40. >directories. Is this auto translated?
  41. # is the comment marker in PERL. COMMAND.COM uses the REM command.
  42. Since Perl can run on many systems that don't have the "magic number"
  43. method if having an interpreter run a file, (any file that starts with
  44. #! the following characters are the name of the program to run) Perl
  45. scans the first line for options itself.
  46.  
  47. COMMAND.COM forces directories to be separated by a \, internally DOS
  48. accepts either a \ or a /. But actually perl doesn't even look to see if
  49. /usr/bin/perl actually exists, it just checks that the first to characters
  50. are #! and the first line mentions perl somewhere. It will the take the
  51. options that are after the /usr/bin/perl (or /fred/flinstone/perl, whatever)
  52.  
  53. >Also, how are the flags and parameters from either the command line
  54. >or the #! line referenced in the Perl script. I thought I
  55. >understood this in the Unix version, but I am even more confused
  56. >in the DOs versions. I am obviously new to all of this.
  57.  
  58. In the DOS version, if you have 4DOS to execute the file FOO.PL with the
  59. perl interpreter, and add a parameter BAR (FOO BAR) the command that a
  60. actually gets executed is PERL.EXE FOO.PL BAR
  61. BAR is now available in the @ARGV array. Any options to perl itself can
  62. be specified on the first line as #!/usr/bin/perl -n
  63. or by explicitly starting the perl interpreter with the appropriate options
  64. PERL -n FOO.PL BAR
  65.  
  66. >Thanks for the help.
  67.  
  68. >Henry Manaster
  69.  
  70. >-- 
  71. >***************************************************************************
  72. >    Henry Manaster          *     EMail: manaster@yu1.yu.edu
  73. >    Brooklyn, NY            *
  74. >                                *
  75. >    Disclaimer: The above is not necessarily MY opinion nor that 
  76. >                of anyone else :-)  ????!
  77. >****************************************************************************
  78. -- 
  79. ----
  80.