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

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

Thread Previous
Rick Delaney
March 28, 2000 21:41
Re: [ID 20000325.009] `syntax error' message not trapped by $SIG{__DIE__}
Message ID:

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

It was changed for strict warnings so that they can be caught in eval.
That was change 4197.  For instance,

    use strict;
    eval q{
        $x = 1;
    } or print "Caught:[$@]";

now prints "Caught:[Global symbol..." etc.  Much nicer than before.

...searching perldelta...

=head2 All compilation errors are true errors

Some "errors" encountered at compile time were by neccessity 
generated as warnings followed by eventual termination of the
program.  This enabled more such errors to be reported in a
single run, rather than causing a hard stop at the first error
that was encountered.

The mechanism for reporting such errors has been reimplemented
to queue compile-time errors and report them at the end of the
compilation as true errors rather than as warnings.  This fixes
cases where error messages leaked through in the form of warnings
when code was compiled at run time using C<eval STRING>, and
also allows such errors to be reliably trapped using C<eval "...">.

I infer from this that $SIG{__DIE__} should also now be getting all
these, just like $@ is.

Rick Delaney

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About