This really isn't a DBI question. You would have been better off asking it in one of the general forums.

There are really two approaches to take. One is to replace all calls to "die" in your program with calls to your own function (called, perhaps, "log_and_die") which logs the message and then calls die.

The other approach would be to override Perl's default "die" handling by putting a reference to a die handler in $SIG{__DIE__}.