From: aml@world.std.com (Andrew M Langmead)
Subject: Re: *sigh* Yes, the eternal question: How do I run it under 4dos aga
Organization: The World @ Software Tool & Die
Date: Fri, 8 Jan 1993 17:32:49 GMT

manaster@yu1.yu.edu (Chaim Manaster) writes:

>In article <0L1PwB5w165w@cybrspc.UUCP> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:
>>
>>Not in the .ini, but in autoexec.bat, put
>>
>>set .pl=c:\where\ever\perl.exe
>>
>>Works for me.  For command line flags, put 'em in the #!/usr/bin/perl
>>line at the beginning of the script.
>>--

>Could you provide an example of  using the command line flags and
>how they go into the #!/usr/bin/perl line when using 4dos. Also
>what would the actual command line inokation be? Also is there a
>difference between "flags" and file parameters on the command line?

The 4DOS command processor, when looking for a file to execute, besides
looking for files with .COM, .EXE, .BAT, and .BTM (4DOS fast batch files)
also certain user defined "executable extentions." The user defines
an executable extentions with a SET command like above. This tells
4DOS that if an user types FOO at the command prompt, and there isn't
a FOO.COM, FOO.EXE, FOO.BAT, or FOO.BTM, that it should then look for
a FOO.PL file. If it finds FOO.PL it will execute it be running the
command C:\WHERE\EVER\PERL.EXE FOO.BTM

>I also don't quite understand the logic here? Isn't the # sign the
>comment marker in DOS, so how is anything on that line actually
>used? Also in DOS it is the \ rather than the / that demarks
>directories. Is this auto translated?
# is the comment marker in PERL. COMMAND.COM uses the REM command.
Since Perl can run on many systems that don't have the "magic number"
method if having an interpreter run a file, (any file that starts with
#! the following characters are the name of the program to run) Perl
scans the first line for options itself.

COMMAND.COM forces directories to be separated by a \, internally DOS
accepts either a \ or a /. But actually perl doesn't even look to see if
/usr/bin/perl actually exists, it just checks that the first to characters
are #! and the first line mentions perl somewhere. It will the take the
options that are after the /usr/bin/perl (or /fred/flinstone/perl, whatever)

>Also, how are the flags and parameters from either the command line
>or the #! line referenced in the Perl script. I thought I
>understood this in the Unix version, but I am even more confused
>in the DOs versions. I am obviously new to all of this.

In the DOS version, if you have 4DOS to execute the file FOO.PL with the
perl interpreter, and add a parameter BAR (FOO BAR) the command that a
actually gets executed is PERL.EXE FOO.PL BAR
BAR is now available in the @ARGV array. Any options to perl itself can
be specified on the first line as #!/usr/bin/perl -n
or by explicitly starting the perl interpreter with the appropriate options
PERL -n FOO.PL BAR

>Thanks for the help.

>Henry Manaster

>-- 
>***************************************************************************
>	Henry Manaster          *     EMail: manaster@yu1.yu.edu
>	Brooklyn, NY            *
>                                *
>	Disclaimer: The above is not necessarily MY opinion nor that 
>				of anyone else :-)  ????!
>****************************************************************************
> 
-- 
----
Newsgroups: comp.lang.perl