package DBM::Deep::Hash;
-use 5.6.0;
+use 5.006_000;
use strict;
use warnings;
-our $VERSION = q(0.99_03);
+our $VERSION = q(1.0005);
use base 'DBM::Deep';
sub STORE {
my $self = shift->_get_self;
DBM::Deep->_throw_error( "Cannot use an undefined hash key." ) unless defined $_[0];
- my $key = ($self->_storage->{filter_store_key})
+ my $key = ($self->_storage->{filter_store_key})
? $self->_storage->{filter_store_key}->($_[0])
: $_[0];
my $value = $_[1];
sub EXISTS {
my $self = shift->_get_self;
DBM::Deep->_throw_error( "Cannot use an undefined hash key." ) unless defined $_[0];
- my $key = ($self->_storage->{filter_store_key})
+ my $key = ($self->_storage->{filter_store_key})
? $self->_storage->{filter_store_key}->($_[0])
: $_[0];
sub DELETE {
my $self = shift->_get_self;
DBM::Deep->_throw_error( "Cannot use an undefined hash key." ) unless defined $_[0];
- my $key = ($self->_storage->{filter_store_key})
+ my $key = ($self->_storage->{filter_store_key})
? $self->_storage->{filter_store_key}->($_[0])
: $_[0];
}
sub FIRSTKEY {
- ##
- # Locate and return first key (in no particular order)
- ##
+ ##
+ # Locate and return first key (in no particular order)
+ ##
my $self = shift->_get_self;
- ##
- # Request shared lock for reading
- ##
- $self->lock( $self->LOCK_SH );
-
- my $result = $self->_engine->get_next_key( $self );
-
- $self->unlock();
-
- return ($result && $self->_storage->{filter_fetch_key})
+ ##
+ # Request shared lock for reading
+ ##
+ $self->lock( $self->LOCK_SH );
+
+ my $result = $self->_engine->get_next_key( $self );
+
+ $self->unlock();
+
+ return ($result && $self->_storage->{filter_fetch_key})
? $self->_storage->{filter_fetch_key}->($result)
: $result;
}
sub NEXTKEY {
- ##
- # Return next key (in no particular order), given previous one
- ##
+ ##
+ # Return next key (in no particular order), given previous one
+ ##
my $self = shift->_get_self;
- my $prev_key = ($self->_storage->{filter_store_key})
+ my $prev_key = ($self->_storage->{filter_store_key})
? $self->_storage->{filter_store_key}->($_[0])
: $_[0];
- ##
- # Request shared lock for reading
- ##
- $self->lock( $self->LOCK_SH );
-
- my $result = $self->_engine->get_next_key( $self, $prev_key );
-
- $self->unlock();
-
- return ($result && $self->_storage->{filter_fetch_key})
+ ##
+ # Request shared lock for reading
+ ##
+ $self->lock( $self->LOCK_SH );
+
+ my $result = $self->_engine->get_next_key( $self, $prev_key );
+
+ $self->unlock();
+
+ return ($result && $self->_storage->{filter_fetch_key})
? $self->_storage->{filter_fetch_key}->($result)
: $result;
}