Subject: | use of ($k,$v) = each(%read) doesn't seem to work right |
I'm trying to iterate through all keys/values using
#iterate through a CDB
while(my($k,$v) = each(%read)){
#do something
}
in each iteration, the value of $k seems correct, but the value of $v is
the same as $k, rather than being the value in the database.
I tried the following patch which seems to fix the issue:
--- /usr/lib/perl5/site_perl/5.8.0/CDB_Perl/Read.pm.old 2008-03-12
11:47:16.000000000 -0400
+++ /usr/lib/perl5/site_perl/5.8.0/CDB_Perl/Read.pm 2008-03-12
11:47:40.000000000 -0400
@@ -203,7 +203,7 @@ sub FETCH{
my $lkey = $self->{'tie'}->{'lastkey'};
if(defined($lkey) && $key eq $lkey){
- return $lkey;
+ return $self->{'tie'}->{'lastvalue'};
}
my $value = $self->get_value($key);