RE: PERL DBI documentatio -- how to check for errors
Nitzan Shaked <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <000001c5ec37$30bfa6b0$0100000a@hellfire> |
I actually read "programming the PERL DBI", and it seems that everyone agrees "RaiseError" rules. However, I do have on my hands a system of 30K+ PERL lines. The DBI error checking is "in place" and so is the code to handle the errors. It's just that I am not so sure the checking itself is done properly. Now, *everybody* knows you don't go around changing the structure of a large existing system. I *am* willing to change "$rv or die..." to "defined $rv or die...". Or similar changes. So -- thank you the response (I mean it), but can anyone please give a precise definition as how to check for errors in selectall_foo(), selectrow_foo(), and do() ? Much obligied. -----Original Message----- From: Jochen Wiedmann [mailto:[email protected]] Sent: Thursday, November 17, 2005 14:18 PM To: Nitzan Shaked Cc: [email protected]; [email protected] Subject: Re: PERL DBI documentatio -- how to check for errors Nitzan Shaked wrote: > The documentation for how to check the success of various DBI calls, and in > particular do(), selectrow_foo() and selectall_foo() is unclear and not > precise, at least for me. Actually I am not sure, after scrutinizing, how > exactly to check for errors. It is quite easy: If it is not for reasons of upwards compatibility, there is absolutely *no* excuse for not setting the "RaiseError" flag and using exception handlers for catching errors. That works guaranteed and always, allows you to ignore the return codes and stuff like that and, sooner or later, will make your code drastically simpler and better to read. (Unless, of course, you ignore error messages completely, which is even more simple to read, but obiusly not better.) "RaiseError" rules. Jochen -- MySQL Documentation Mailing List For list archives: http://lists.mysql.com/mysqldoc To unsubscribe: http://lists.mysql.com/[email protected] -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]