sub Something { local $@; # Don't step on other code. # try eval{ local $SIG{__DIE__}; # No sigdie handler # do stuff that might die } # catch HandleEvalError( $@ ) if $@; } #### BEGIN{ $SIG{__DIE__} = \&FatalErr } # Real problem if compile fails before getting here. sub FatalErr { # do stuff, maybe print @_ or something. }