Object::Transaction is a virtual base class for transactions on files containing serialized hash objects.
SYNOPSIS
use Object::Transaction;
transaction($coderef, @codeargs);
commit();
abandon();
$there_is_a_pending_transaction = transaction_pending()
package Pkg;
@ISA = qw(Object::Transaction);
use Object::Transaction;
$obj = sub new { ... }
sub file($ref,$id) { ... }
$obj = load Pkg $id;
$obj->savelater();
$obj->save();
$obj->removelater();
$obj->remove();
$obj->commit();
$obj->uncache();
$obj->abandon();
$oldobj = $obj->old();
$reference = $obj->objectref();
$obj = $reference->loadref();
$id = sub id { ... }
$restart_commit = sub precommit() { }
@passby = sub presave($old) { ... }
sub postsave($old,@passby) { ... }
$newid = sub preload($id) { .... }
sub postload() { ... }
sub preremove() { ... }
sub postremove() { ... }
Object::Transaction provides transaction support for hash-based objects that are stored one-per-file using Storable. Multiuser access is supported. In the future, serializing methods other than Storable will be supported.
Object::Transaction is a virtual base class. In order to use it, you must inherit from it and override the new method and the file method.
Optomistic locking is used: it is possible that a transaction will fail because the data that is is based upon has changed out from under it.
Product's homepage
Requirements:
· Perl