On Mon, 15 Dec 2003 12:57:32 -0500 [EMAIL PROTECTED] wrote:

> If I'm handling errors with eval {} if ($@) {} constructs, is there any
> hidden gotcha to grouping several statements in a single eval if I want
> any errors handled identically?  For instance, can I wrap an execute
> and its fetches into one eval, as below, or is this something I should
> be wary of?

> if ($@) {
>     $dbh->rollback();
>     close(OUT);
>     print "Error retrieving data\n";
>     exit();
>     }

It would be useful to know what went wrong.  You should either include $@
in the print(), or capture $DBI::errstr before calling rollback() and
print that.

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to