DBIx::TransactionManager::Extended - extended DBIx::TransactionManager
use DBI; use DBIx::TransactionManager::Extended; my $dbh = DBI->connect('dbi:SQLite:'); my $tm = DBIx::TransactionManager::Extended->new($dbh); # begin transaction $tm->txn_begin; # execute query $dbh->do("insert into foo (id, var) values (1,'baz')"); # And you can do multiple database operations here for my $data (@data) { push @{ $txn->context_data->{data} } => $data; $tm->add_hook_after_commit(sub { my $context_data = shift; # with the current (global) transaction my @data = @{ $context_data->{data} }; return unless @data; ... $context_data->{data} = []; }); } # and commit it. $tm->txn_commit;
DBIx::TransactionManager::Extended is extended DBIx::TransactionManager. This module provides some useful methods for application development.
This is a accessor for a context data. The context data is a associative array about a current transaction's context data.
Adds hook that run at before the commit all transactions.
Adds hook that run at after the commit all transactions.
Removes hook that run at before the commit all transactions.
Removes hook that run at after the commit all transactions.
DBIx::TransactionManager
Copyright (C) karupanerura.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
karupanerura <karupa@cpan.org>
To install DBIx::TransactionManager::Extended, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::TransactionManager::Extended
CPAN shell
perl -MCPAN -e shell install DBIx::TransactionManager::Extended
For more information on module installation, please visit the detailed CPAN module installation guide.