Had to turn off caching, but I've merged everything from SPROUT's fixes
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Hash.pm
index 102f367..40f0bf6 100644 (file)
@@ -4,8 +4,7 @@ use 5.006_000;
 
 use strict;
 use warnings FATAL => 'all';
-
-our $VERSION = $DBM::Deep::VERSION;
+no warnings 'recursion';
 
 use base 'DBM::Deep';
 
@@ -103,10 +102,12 @@ sub first_key { (shift)->FIRSTKEY(@_) }
 sub next_key  { (shift)->NEXTKEY(@_)  }
 
 sub _clear {
-    my $self = shift;
+    my $self = shift->_get_self;
 
-    while ( my $key = $self->first_key ) {
+    while ( defined(my $key = $self->first_key) ) {
+      do {
         $self->_engine->delete_key( $self, $key, $key );
+      } while defined($key = $self->next_key($key));
     }
 
     return;