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

[MacPerl] MPW Perl exit status



Looking through Chris & Vicki's chapter on MPW Perl, I noticed that
the 1st line for embedding a Perl script within a MPW script is
described as:
    perl -Sx "{0}" {"Parameters"}; Exit
whereas I've always used:
    perl -Sx "{0}" {"Parameters"}; Exit {Status}

I tried an example to see if the {Status} argument was actually
needed to return the status in this way, and I was surprised to
discover an unrelated problem:

***  My MPW MacPerl tool does not ever provide a return status
***  value, although I think this has worked in the past.

I'm using MPW 3.4.2 and Big MacPerl 5.1.8r4 on a Quadra 840av (68040)
running System 7.6.2.

I tried several combinations of script complexity and MPW worksheet
commands, and finally came down to this as the simplest example of
the problem:

    Set exit 0        # Prevent MPW from quiting on non-zero status
    perl -e 'exit 1;'
    Echo {Status}

Selecting and executing the 3 lines above echoes a blank line always,
no matter what value is used for perl's exit statement, and so does
the even simpler second line of      perl -e '1;'

Replacing the second line with a call to a compiled C language
MPW tool program such as:

    main( int argc, char **argv ){ exit( atoi( *++argv ) ); }

works as expected by echoing whatever number is given as the 1st
argument for this tool. And, almost incidentally now, I used this
tool program to answer my original question: it turns out that the
{Status} argument is *not* needed after an MPW script Exit statement
when it is used as shown above, so the book is OK as-is.

    -Paul-     paul.b.patton@hbc.honeywell.com


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch