1DBIx::Class::Storage::TUxsneSrcoCpoenGturairbdu(t3e)d PeDrBlIxD:o:cCulmaesnst:a:tSitoonrage::TxnScopeGuard(3)
2
3
4
6 DBIx::Class::Storage::TxnScopeGuard - Scope-based transaction handling
7
9 sub foo {
10 my ($self, $schema) = @_;
11
12 my $guard = $schema->txn_scope_guard;
13
14 # Multiple database operations here
15
16 $guard->commit;
17 }
18
20 An object that behaves much like Scope::Guard, but hardcoded to do the
21 right thing with transactions in DBIx::Class.
22
24 new
25 Creating an instance of this class will start a new transaction (by
26 implicitly calling "txn_begin" in DBIx::Class::Storage. Expects a
27 DBIx::Class::Storage object as its only argument.
28
29 commit
30 Commit the transaction, and stop guarding the scope. If this method is
31 not called and this object goes out of scope (e.g. an exception is
32 thrown) then the transaction is rolled back, via "txn_rollback" in
33 DBIx::Class::Storage
34
36 "txn_scope_guard" in DBIx::Class::Schema.
37
39 Ash Berlin, 2008.
40
41 Inspired by Scope::Guard by chocolateboy.
42
43 This module is free software. It may be used, redistributed and/or
44 modified under the same terms as Perl itself.
45
46
47
48perl v5.12.0 2010-05D-B1I2x::Class::Storage::TxnScopeGuard(3)