DBIx::Class::Storage::TxnScopeGuard(3pm)

DBIx::Class::Storage::TxnScopeGuard3pm

Scope-based transaction handling

Usage

 sub foo {
   my ($self, $schema) = @_;
   my $guard = $schema->txn_scope_guard;
   # Multiple database operations here
   $guard->commit;
 }

Overview

An object that behaves much like Scope::Guard, but hardcoded to do the right thing with transactions in DBIx::Class.

Methods

new

Creating an instance of this class will start a new transaction (by implicitly calling "txn_begin" in DBIx::Class::Storage. Expects a DBIx::Class::Storage object as its only argument.

commit

Commit the transaction, and stop guarding the scope. If this method is not called and this object goes out of scope (e.g. an exception is thrown) then the transaction is rolled back, via "txn_rollback" in DBIx::Class::Storage

Further questions?

Check the list of additional DBIC resources.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 7 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10–11
  7. 12
  8. 13

From libdbix-class-perl 0.082844-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.