X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBM%2FDeep%2FArray.pm;h=247d7307c3998c747cde8262928e830e6c1afde4;hb=2ba14e04118fbfa4f41947ac9273b97ca1cb78e2;hp=b4a4636cf8bdef9ce4807e9453f773067528212a;hpb=d426259cc2e19971b01c53960085c8b08ff22e2d;p=dbsrgits%2FDBM-Deep.git diff --git a/lib/DBM/Deep/Array.pm b/lib/DBM/Deep/Array.pm index b4a4636..247d730 100644 --- a/lib/DBM/Deep/Array.pm +++ b/lib/DBM/Deep/Array.pm @@ -5,6 +5,8 @@ use 5.006_000; use strict; use warnings FATAL => 'all'; +our $VERSION = $DBM::Deep::VERSION; + # This is to allow DBM::Deep::Array to handle negative indices on # its own. Otherwise, Perl would intercept the call to negative # indices for us. This was causing bugs for negative index handling. @@ -392,6 +394,18 @@ sub _copy_node { return 1; } +sub _clear { + my $self = shift; + + my $size = $self->FETCHSIZE; + for my $key ( 0 .. $size - 1 ) { + $self->_engine->delete_key( $self, $key, $key ); + } + $self->STORESIZE( 0 ); + + return; +} + sub length { (shift)->FETCHSIZE(@_) } sub pop { (shift)->POP(@_) } sub push { (shift)->PUSH(@_) }