The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

 OOPS::TxHash - Transactions on a simple hash

SYNOPSIS

 use OOPS::TxHash;

 my %underlying_hash;
 my $th = tie my %hash, 'OOPS::TxHash', \%underlying_hash or die;

 $th->commit;
 $th->abort;

DESCRIPTION

OOPS::TxHash provides transactions on a hash. Changes to the tied hash will only be reflected on the underlying if commit() is called.

This is not recursive: if a hash value is a reference and the reference is followed to a value and the value is changed, it will be changed for both the hash and the underlying hash.

The abort() method will reset the values of the hash to the underlying hash.

No commit() is called by DESTROY: you must call commit() explicitly if you want the changes preserved.