From: rkinyon Date: Sun, 9 Apr 2006 01:38:17 +0000 (+0000) Subject: Intermediate commit prior to radical file format change X-Git-Tag: 0-99_01~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fee0243f56b6ae631af93340c6e14088d6e535b6;p=dbsrgits%2FDBM-Deep.git Intermediate commit prior to radical file format change --- diff --git a/MANIFEST b/MANIFEST index 5bf3774..23929d1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -35,6 +35,7 @@ t/24_autobless.t t/25_tie_return_value.t t/26_scalar_ref.t t/27_filehandle.t +t/28_transactions.t t/29_freespace_manager.t t/30_already_tied.t t/31_references.t diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index 21adc09..98d5df9 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -362,6 +362,18 @@ sub clone { } } +sub begin_work { + my $self = shift->_get_self; +} + +sub rollback { + my $self = shift->_get_self; +} + +#sub commit { +# my $self = shift->_get_self; +#} + ## # Accessor methods ## diff --git a/t/28_transactions.t b/t/28_transactions.t new file mode 100644 index 0000000..d0b34fd --- /dev/null +++ b/t/28_transactions.t @@ -0,0 +1,21 @@ +use strict; +use Test::More tests => 4; +use Test::Exception; +use t::common qw( new_fh ); + +use_ok( 'DBM::Deep' ); + +my ($fh, $filename) = new_fh(); +my $db = DBM::Deep->new( + file => $filename, +); + +$db->{x} = 'y'; +is( $db->{x}, 'y' ); +$db->begin_work; +$db->{x} = 'z'; +is( $db->{x}, 'z' ); +$db->rollback; +is( $db->{x}, 'y' ); + +# Add a commit test using fork