Removed deep recursion warning by converting tail-recursive function to an iterative...
rkinyon [Tue, 5 Dec 2006 03:02:23 +0000 (03:02 +0000)]
lib/DBM/Deep/Engine3.pm
t/10_largekeys.t [moved from t/10_largekeys.todo with 100% similarity]

index c82c76a..0290620 100644 (file)
@@ -712,14 +712,17 @@ sub chain_loc {
 sub data {
     my $self = shift;
 
-    my $chain_loc = $self->chain_loc;
+    my $data;
+    while ( 1 ) {
+        my $chain_loc = $self->chain_loc;
 
-    my $data = $self->engine->storage->read_at(
-        $self->offset + 2 + $self->engine->byte_size + 1, $self->data_length,
-    );
+        $data .= $self->engine->storage->read_at(
+            $self->offset + 2 + $self->engine->byte_size + 1, $self->data_length,
+        );
 
-    if ( $chain_loc ) {
-        $data .= $self->engine->_load_sector( $chain_loc )->data;
+        last unless $chain_loc;
+
+        $self = $self->engine->_load_sector( $chain_loc );
     }
 
     return $data;
similarity index 100%
rename from t/10_largekeys.todo
rename to t/10_largekeys.t