More Errors
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:
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? :-)
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