From 22c3a558a0abcacc2ee3327a5f69d152a538f201 Mon Sep 17 00:00:00 2001 From: octo Date: Tue, 12 Apr 2005 18:07:27 +0000 Subject: [PATCH] Moved to a pseudo-tie interface. Hopefully this works.. --- lib/Onis/Data/Persistent/Dbm.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Onis/Data/Persistent/Dbm.pm b/lib/Onis/Data/Persistent/Dbm.pm index bc24550..397ae8c 100644 --- a/lib/Onis/Data/Persistent/Dbm.pm +++ b/lib/Onis/Data/Persistent/Dbm.pm @@ -107,7 +107,6 @@ sub put my $obj = shift; my $key = shift; my @fields = @_; - my $db = $obj->{'data'}; if ($obj->{'num_fields'} != scalar (@fields)) { @@ -172,9 +171,11 @@ sub keys my $val; no strict (qw(subs)); - for ($db->seq ($key, $val, R_FIRST); $db->seq ($key, $val, R_NEXT) == 0;) + for (($key, $val) = $db->FIRSTKEY (); ($key, $val) = $db->NEXTKEY ($key);) { + die unless (defined ($key)); next if (defined ($obj->{'cache'}{$key})); + $obj->{'cache'}{$key} = [split ($Alarm, $val)]; } @@ -215,14 +216,14 @@ sub del { if (defined ($obj->{'cache'}{$key})) { - $db->del ($key); + $db->DELETE ($key); $obj->{'cache'}{$key} = undef; } # It's known that the key doesn't exist.. } else { - $db->del ($key); + $db->DELETE ($key); $obj->{'cache'}{$key} = undef; } } @@ -239,7 +240,7 @@ sub sync my $val = join ($Alarm, @{$obj->{'cache'}{$key}}); - $db->put ($key, $val); + $db->STORE ($key, $val); delete ($obj->{'cache'}{$key}); } -- 2.11.0