http://www.perlmonks.org?node_id=373508


in reply to DBI recipes

Just to answer Abigail-II's concerns mentioned earlier, I'll mention that there is a section in the DBI docs on Transactions that goes over an idiomatic method of error handling. I won't repeat it in detail, but to summarize, set RaiserError on, wrap all DBI operations in one big eval block, check $@ after exiting the eval block, and rollback the transaction if there was an error (update: and commit if there was no error). You can even set RaiseError during the connect (in which case you would not rollback if there were an error during the connect), and do the connect inside the eval block, which the example in the docs does not do.

An updated link: DBI transactions

Replies are listed 'Best First'.
Re: Error handling and transactions
by tphyahoo (Vicar) on Dec 12, 2005 at 14:09 UTC
    Just to be a little more concrete, I think the section being referred to is here.