More Errors

| | Comments (0)
When last we left, I was concerned about error reporting in MacPerl. I still thought and think that MPW formatting should be the default, but what about all those broken tests? What if someone wants Unix-style errors?

So I wrote a function to allow specifying the behavior. MacPerl::ErrorFormat lets you choose the format style, with a 0 for Unix or 1 for MPW. Default is 1. Sounds reasonable. And you can optionally call a pragma (for now called "mpwerr"), like so:

    perl -Mmpwerr=unix -e 'die "foo"'

and you get Unix-style errors. The pragma has kindof a weird problem though; I wanted people to be able to call it on the command line as above. The problem is the command line is called before xs_init(), which is where the MacPerl package is loaded in and bootstrapped. Nuts. So we put off execution until CHECK, which seems to work fine, but it means the pragma can only be called once, which I think is fine. If you want to go back and forth in your program, use the function itself instead of the pragma.

I think I might change the name to MacPerl::err or something.

Syntax checks for now will *always* have a "#" in front of them, no matter what happens with ErrorFormat.

I might not get the release out tonight. Oh well, who would mess with it this weekend anyway? :-)

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on August 31, 2001 7:19 PM.

Patches was the previous entry in this site.

Even More Errors is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.