Home: Perl Programming Help: DBI:
logging the exception in perl


Aug 3, 2006, 7:50 AM

Views: 4670
logging the exception in perl

hi all

I want to write the exception message ( the statement with die "stmt") into a required file.

pls any help will be gr8ly appreciated.


Thaumaturge / Moderator

Aug 4, 2006, 3:47 AM

Views: 4667
Re: [rajjj] logging the exception in perl

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__}.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks