DBIx::TransactionManager::Developers - docs for developers
This document describes a document for O/R mapper writer and/or DBIx::* writer.
Create a new DBIx::TransactionManager::ScopeGuard's instance object.
You can pass an optional argument to %args, to tell the scope guard where the scope was generated, like so:
%args
package Foo; use Moose; sub mymethod { my $self = shift; my $txn = $tm->txn_scope( caller => [ caller() ] ); return $txn; } package main; my $obj = Foo->new(); my $txn = $obj->mymethod();
This will allow the guard object to report the caller's location from the perspective of mymethod(), not where txn_scope() was called.
mymethod()
txn_scope()
see "DBIx::TransactionManager::ScopeGuard's METHODS"
Start the transaction.
txn_begin may optionally take a 'caller' argument. This will allow you to provide caller information which will be used in in_transaction. For example if you have a wrapper function that calls txn_begin, you may want to let the user think that the caller was one stack above your wrapper.
txn_begin
in_transaction
# use __my__ caller! $tm->txn_begin( caller => [ caller(0) ] );
Commit the current transaction.
If the $dbh is in a nested transaction, TransactionManager doesn't do COMMIT at here. TM just poped transaction stack and do nothing.
$dbh
Rollback the current transaction.
If the $dbh is in a nested transaction, TransactionManager doesn't do ROLLBACK at here. TM just poped transaction stack and do nothing.
Returns true if $txn is currently in a middle of a transaction. While normally you only need to use this value as a boolean, it actually returns a hashref consisting of 'caller' and 'pid' element. This will tell you exactly where the currently valid transaction started.
To install DBIx::TransactionManager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::TransactionManager
CPAN shell
perl -MCPAN -e shell install DBIx::TransactionManager
For more information on module installation, please visit the detailed CPAN module installation guide.