From: Ash Berlin Date: Wed, 16 Jul 2008 16:41:52 +0000 (+0000) Subject: Update docs re txn_scope_guard X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89028f42595b587599191bad8d1b5fe17f11c131;p=dbsrgits%2FDBIx-Class-Historic.git Update docs re txn_scope_guard --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 7a358bd..f878d89 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -721,9 +721,10 @@ sub txn_do { $self->storage->txn_do(@_); } -=head2 txn_scope_guard +=head2 txn_scope_guard (EXPERIMENTAL) -Runs C on the schema's storage. +Runs C on the schema's storage. See +L. =cut diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index dd61ba0..604ad5b 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -299,9 +299,21 @@ sub svp_rollback { die "Virtual method!" } =for comment -=head2 txn_scope_guard +=head2 txn_scope_guard (EXPERIMENTAL) -Return an object that does stuff. +An alternative way of using transactions to C: + + my $txn = $storage->txn_scope_guard; + + $row->col1("val1"); + $row->update; + + $txn->commit; + +If a exception occurs, the transaction will be rolled back. This is still very +experiemental, and we are not 100% sure it is working right when nested. The +onus is on you as the user to make sure you dont forget to call +$C<$txn->commit>. =cut