{ $old_handler = $SIG{__DIE__}; $SIG{__DIE__} = sub { # test for dbi error and do things or "redie"}; #DBI call $SIG{__DIE__} = $old_handler; }