Intermediate commit prior to radical file format change
rkinyon [Sun, 9 Apr 2006 01:38:17 +0000 (01:38 +0000)]
MANIFEST
lib/DBM/Deep.pm
t/28_transactions.t [new file with mode: 0644]

index 5bf3774..23929d1 100644 (file)
--- 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
index 21adc09..98d5df9 100644 (file)
@@ -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 (file)
index 0000000..d0b34fd
--- /dev/null
@@ -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