PDA

View Full Version : perl cgi database error handling


dandelion
07-26-2005, 08:29 PM
Currently I am doing a perl-mysql project. and I used to program in java.
I have a question about database error handling.

In java, for each jdbc error we use catch , and in business layer write some meaningful message, then send this message to jsp page.

So how can I handle the DBI error nicely rather than just use die and throw a ugly database error message?

Thank you.

FishMonger
07-27-2005, 04:00 AM
You can write your own error subroutine and call it rather than die.
http://search.cpan.org/dist/perl/pod/perlsub.pod

other reading
http://jimfl.tensegrity.net/eh/ExceptionHandling.html

Also search cpan, there should be several error handling modules that you might find useful.