From: rkinyon Date: Wed, 24 Jan 2007 03:37:11 +0000 (+0000) Subject: r14929@rob-kinyons-computer: rob | 2007-01-23 21:02:26 -0500 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7646eac3962ccce0f86bda86c3fcb6238891f886;p=dbsrgits%2FDBM-Deep.git r14929@rob-kinyons-computer: rob | 2007-01-23 21:02:26 -0500 Further cleanup --- diff --git a/lib/DBM/Deep.pod b/lib/DBM/Deep.pod index d1dbe4e..cd4981b 100644 --- a/lib/DBM/Deep.pod +++ b/lib/DBM/Deep.pod @@ -1098,6 +1098,27 @@ writeonly mode. STORE will verify that the filehandle is writable. However, ther doesn't seem to be a good way to determine if a filehandle is readable. And, if the filehandle isn't readable, it's not clear what will happen. So, don't do that. +=head2 ASSIGNMENTS WITHIN TRANSACTIONS + +The following will I work as one might expect: + + my $x = { a => 1 }; + + $db->begin_work; + $db->{foo} = $x; + $db->rollback; + + is( $x->{a}, 1 ); # This will fail! + +The problem is that the moment a reference used as the rvalue to a DBM::Deep +object's lvalue, it becomes tied itself. This is so that future changes to +C<$x> can be tracked within the DBM::Deep file and is considered to be a +feature. By the time the rollback occurs, there is no knowledge that there had +been an C<$x> or what memory location to assign an C to. + +B This does not affect importing because imports do a walk over the +reference to be imported in order to explicitly leave it untied. + =head1 CODE COVERAGE B is used to test the code coverage of the tests. Below is the diff --git a/t/36_transaction_deep.todo b/t/36_transaction_deep.todo deleted file mode 100644 index 0458f58..0000000 --- a/t/36_transaction_deep.todo +++ /dev/null @@ -1,38 +0,0 @@ -use strict; -use Test::More tests => 7; -use Test::Deep; -use t::common qw( new_fh ); - -use_ok( 'DBM::Deep' ); - -my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( - file => $filename, - locking => 1, - autoflush => 1, - num_txns => 16, -); - -my $outer = { a => 'b' }; -my $inner = { a => 'c' }; - -$db->{x} = $outer; -is( $db->{x}{a}, 'b', "BEFORE: We're looking at the right value from outer" ); - -$db->begin_work; - - $db->{x} = $inner; - is( $db->{x}{a}, 'c', "WITHIN: We're looking at the right value from inner" ); -TODO: { - local $TODO = "Transactions not done yet"; - is( $outer->{a}, 'b', "WITHIN: We're looking at the right value from outer" ); -} - -$db->commit; - -is( $db->{x}{a}, 'c', "AFTER: Commit means inner is still correct" ); -TODO: { - local $TODO = "Transactions not done yet"; -is( $outer->{a}, undef, "AFTER: outer made the move" ); -} -is( $inner->{a}, 'c', "AFTER: inner made the move" );