I was trying out some jobs with the Berkeley DB and decided to move up from DB_File to BerkeleyDB. I don't need a lot of features, just speed.

But I keep running into a "dumb" error that doesn't make any sense to me.
untie attempted while 1 inner references still exist at ./dbm_test.pl line 31.

According to docs and the old DB_File method...  I shouldn't get this warning.
I can't find anything that's not working with the code, but I don't like errors just the same...

Any ideas?

#!/usr/bin/perl

use strict;
use warnings;
use BerkeleyDB;
use Digest::MD5 qw[md5_hex];
use Time::HiRes qw[tv_interval gettimeofday];
use Data::Dumper;

my %hash;
my $db = tie %hash, "BerkeleyDB::Hash",
  -Filename => 'authentication.db',
  -Flags    => DB_CREATE
  or die "yer fucked!\n";

for(my $x = 0; $x<10_000; $x++) {
  my $y = int(1 + rand(10_000_000));
  my $t = [gettimeofday];
  if(exists $hash{$y}) {
    my $value = $hash{$y};
    print "get ";
  } else {
    my $value = md5_hex(@$t);
    $hash{$y} = $value;
    print "put ";
  }
  print tv_interval($t, [gettimeofday]),"\n";
}

untie %hash;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to