[Catalyst] Best practice for using transactions?

Jon Warbrick jw35 at cam.ac.uk
Fri Dec 15 13:03:44 GMT 2006


Does anyone have any advice on best practise for using transactions in a 
database-based Catalyst app?

I'm using DBIx::Class, and I can see how I can wrap particular processing 
steps with txn_do to impliment transactions. But it seems to me that there 
might, for a general CRUD application, be value in processing each request 
entirely within a transaction by default - read-only requests would then 
get a consistent view of the database, and write requests would be 
all-or-nothing by default.

Trouble is, I can't see how to do this. txn_do seems to be a non-starter 
(no appropriate coderef to wrap), and I can't see where I could 
appropriately call txn_begin/txn_commit/txn_rollback to achieve a useful 
effect.

Any advice from people who've been here before (even if it's 'you don't 
want to do that') would be very welcome.

Jon.

-- 
Jon Warbrick
Web/News Development, Computing Service, University of Cambridge



More information about the Catalyst mailing list