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

Re: [MacPerl] MacPerl warn and die format



> I'm pondering the implications of MacPerl's formatting of warn and die
> messages when the string is not terminated in a newline.
>
> For example, in MacPerl:
>
>     # Warning: something's wrong, <> chunk 1.
>     File ':test.pl'; Line 1
>
>     # Died.
>     File ':test.pl'; Line 1
>
>
> Whereas the 'standard' format is:
>
>     Warning: something's wrong at test.pl line 1, <> chunk 1.
>
>     Died at test.pl line 1.
>
>
>
> I'm curious why it is that MacPerl uses such a different format for warn
> and die.

The MacPerl format is a very nice match to MPW.  When one of these 
messages shows up in an MPW window (such as the Worksheet, but any 
window from which you execute), you merely need to put the cursor in 
that line...or select the error message...and you are taken to the 
offending line in the source file.

File and Line are (aliased to) commands in MPW which open the file in 
a window (if necessary) or bring the file's window to the front, and 
move the selection to the indicated line.

   --John



>
> This makes a difference to modules such as Exporter, which try to do
> munging of the error message:
>
>     local $SIG{__WARN__} = sub {
>         my $text = shift;
>         if ($text =~ s/ at \S*Exporter.pm line \d+.*\n//) {
>             require Carp;
>             local $Carp::CarpLevel = 1; # ignore package calling us too.
>             Carp::carp($text);
>         }
>         else {
>             warn $text;
>         }
>     };
>
>
>
> Would there be any problems in having MacPerl use the same format as the
> regular distribution?

Yes...MacPerl under MPW would become much less pleasant to use.  At 
most, the change should be an option, or only in the non-MPW-tool 
form, or both.

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

--
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA
Give a man a fish and you feed him for a day.  Teach him to fish,
and you get rid of him for the weekend.

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