RE: PERL DBI documentatio -- how to check for errors
Nitzan Shaked <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <000301c5ec3d$d871e430$0100000a@hellfire> |
Thanks again. That's correct, and is one of the alternatives we've considered. However, at the very least for the intellectual curiosity: what IS the answer to my original question? BR, Nitzan -----Original Message----- From: Jochen Wiedmann [mailto:[email protected]] Sent: Friday, November 18, 2005 14:41 PM To: Nitzan Shaked Cc: [email protected] Subject: Re: PERL DBI documentatio -- how to check for errors On 11/18/05, Nitzan Shaked <[email protected]> wrote: > 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. No problem. Set the "RaiseError" flag locally, as in: my $dbh; # Performs a database operation, using the database handle $dbh # We don't know the state of $dbh, but presumably it has "RaiseError" # turned off. But we may turn it on within the following block: { local $dbh->{"RaiseError"} = 1; eval { # Do one or more database operations here ... }; if ($@) { ... } } Note, that you might even encapsulate this in a separate method. Jochen -- Often it does seem a pity that Noah and his party did not miss the boat. (Mark Twain) -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl 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]