in reply to Re^4: Howto enrich errormessages
in thread How to enrich error-messages?

not yet. Fatals are not reported... :)

Yes they are, it was just buggy. (Fixed.) I said "something like" the code that follows. I figured you were smart enough to get it to work. Note that it doesn't mark other lines as "info", it doesn't properly tag multi-line warnings and errors, and it doesn't handle programs that don't return a true value.

Replies are listed 'Best First'.
Re^6: Howto enrich errormessages
by LanX (Saint) on Oct 15, 2009 at 01:34 UTC
    hmm ...
    lanx@nc10-ubuntu:~$ cat >tst.pl use strict; $a=A; lanx@nc10-ubuntu:~$ perl tst.pl Bareword "A" not allowed while "strict subs" in use at tst.pl line 2. Execution of tst.pl aborted due to compilation errors. lanx@nc10-ubuntu:~$ perl -e' > $SIG{__WARN__} = sub { > local ( $/, $,, $! ); > print STDERR "(W) ", @_, "\n"; > }; > > eval { do shift; 1 } or die("(F) $@"); > ' tst.pl lanx@nc10-ubuntu:~$

    and adding an equivalent $SIG{__DIE__} doesn't help :(

    Cheers Rolf

Re^6: Howto enrich errormessages
by LanX (Saint) on Oct 15, 2009 at 15:08 UTC
    reply to the UPDATE:

    Ike, I didn't complain about your code I just explained why I decided to patch diagnostics.

    > I said "something like" the code that follows. I figured you were smart enough to get it to work. Note that it doesn't mark other lines as "info", it doesn't properly tag multi-line warnings and errors, and it doesn't handle programs that don't return a true value.

    I know you said "something like" and I appreciate your help. But after reading the docs for %SIG in perlvar multiple(!) times without getting it to work I decided that patching diagnostics might be even "smarter".

    Cheers Rolf