delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/04/10:02:01

Newsgroups: comp.os.msdos.djgpp
Date: Sun, 4 Mar 2001 14:58:15 +0000 (GMT)
From: Daniel Barker <sokal AT holyrood DOT ed DOT ac DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Penalty for immature language (PERL/BASH)
In-Reply-To: <Pine.SUN.3.91.1010304080956.12520D-100000@is>
Message-ID: <Pine.SOL.4.21.0103041457030.10320-100000@holyrood.ed.ac.uk>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010304080956 DOT 12520D-100000 AT is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 4 Mar 2001, at 8:13, Eli Zaretskii wrote:

> On Sat, 3 Mar 2001, Daniel Barker wrote:
> 
> > YES! There is a file called poo.pl in the same directory. It has the
> > following contents:
> > 
> >  use constant FOO => 4;
> >  use constant BAR => 5;
> > 
> > If I rename this file to something other than poo.pl, the problem goes
> > away.
> > 
> > However, there is still a mystery. Why does this harmless program,
which
> > sets two constants and "does nothing", cause a crash when it is called
> > from another PERL program?
> 
> Try playing with the contents of this file and see if that matters.  
> Also, try putting "#!/usr/local/bin/perl -f" on its first line.
> 
> My suspicion is that this file is passed to DOS, which will blindly try 
> to execute it as if it were a .com program.  You should cause it to be 
> passed to Perl instead.

Yes, you have isolated the problem. Thank you.

If I put #!/usr/local/bin/perl or #!/usr/local/bin/perl at the start of
the first line of poo.pl, there is no "illegal instruction". (I can find
no documentation of -f, and it doesn't seem to be supported by my version
of PERL, so I just leave it out.)

I still have a small question. Neither BASH nor COMMAND.COM will run
poo.pl if I just enter the command poo (without extension). I expect
this. In BASH, I do not have . (current directory) in my PATH, and
COMMAND.COM does not regard .pl files as executable. So why is PERL even
trying to arrange execution of the file poo.pl?

-- 
Daniel Barker.

- Raw text -


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