[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] open() misfeature?



pudge@pobox.com (Chris Nandor) writes:
>At 21.48 97/2/21, John W Baxter wrote:
>>At 13:34 -0500 2/21/97, Chris Nandor wrote:
>>>Then how would BBEdit know how to color the text?  :-)
>>
>>Well, Emacs elects to figure it out based on the !# line.
>
>Aha, but Perl scripts in MacPerl do not require the shebang line ...

It's a good idea to include one anyway (It just has to mention perl, so
I use #!perl usually). If you don't include one, your file will be read
twice.

The reason for this is that MPW script syntax is sufficiently incompatible
with Perl that the only way to write MPW perl scripts is to write them as:

Perl -Sx "{0}" {"Parameters"}; Exit {Status}
#!perl
... Perl script ...

In order to make this style of script writing compatible with the application,
the application does a "soft" version of -x: Like for -x, the script file
is searched for a #! line, but if it is not found, the file is simply reset.
Thus, no error is noticeable, but the script file is read twice.

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "One fine day in my odd past..." -- Pixies, _Planet of Sound_