++ed by:
TOKUHIROM

1 PAUSE user(s)
1 non-PAUSE user(s).

Atsushi Kobayashi

NAME

DBIx::TransactionManager::Developers - docs for developers

DESCRIPTION

This document describes a document for O/R mapper writer and/or DBIx::* writer.

MORE DOCUMETNS for DBIx::TransactionManager class

my $txn = $tm->txn_scope(%args)

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:

    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.

see "DBIx::TransactionManager::ScopeGuard's METHODS"

$tm->txn_begin(%args)

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.

    # use __my__ caller!
    $tm->txn_begin( caller => [ caller(0) ] ); 
$tm->txn_commit()

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.

$tm->txn_rollback()

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.

$tm->in_transaction() : Bool

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.




Hosting generously
sponsored by Bytemark