Mail Archives: djgpp/2001/03/04/10:02:01
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 -