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

> Fixed.

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

> By the way, diagnostics uses $SIG{__WARN__} too

I know, but it has some functionality. I'd like to add a reference to the according diagnostic, which can be displayed in emacs after clicking.

Cheers Rolf

Replies are listed 'Best First'.
Re^5: Howto enrich errormessages
by ikegami (Patriarch) on Oct 15, 2009 at 01:22 UTC

    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.

      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

      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