develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000325.009] `syntax error' message not trapped by $SIG{__DIE__}

Thread Previous | Thread Next
From:
Ilya Zakharevich
Date:
March 28, 2000 19:59
Subject:
Re: [ID 20000325.009] `syntax error' message not trapped by $SIG{__DIE__}
Message ID:
200003290359.WAA08578@monk.mps.ohio-state.edu
mjd@plover.com writes:
>         sub foo { 
>           print "TRAPPED MESSAGE $_[0]\n";
>           exit 0;
>         }
> 
>         BEGIN { $SIG{__DIE__} = \&foo }
> 
>         1+(2*3;

> When run with 5.005_03 or 5.6.0, this yields:

>         syntax error at test.pl line 5, near "3;"
>         TRAPPED MESSAGE Execution of test.pl aborted due to compilation errors.

> I want the `syntax error' message to be trapped also.  The discussion
> of $SIG{__DIE__} in `perlvar' suggests that it should be trapped:
> 
>                `__DIE__'/`__WARN__' handlers are very special in
>                one respect: they may be called to report (proba-
>                ble) errors found by the parser.  In such a case
>                the parser may be in inconsistent state

Did you try setting __WARN__ handler?  Or maybe you want your Perl
compiler exit after one error?  ;-)  [Was this changed recently?]

Ilya

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About