http://www.perlmonks.org?node_id=989260

grondilu has asked for the wisdom of the Perl Monks concerning the following question:

I'm kind of confused in trying to use BerkeleyDB with an environnement

Here is the simplest example I could figure out:

# creating a dummy db first use DB_File; tie my %h, "DB_File", "/tmp/test.db"; $h{foo} = "bar"; untie %h; # now trying to read it use BerkeleyDB; my $db = new BerkeleyDB::Hash -Env => BerkeleyDB::Env->new(-Home => "/tmp"), -Filename => "test.db" or die "could not open database";

This always raises the "could not open database" exception.

What am I missing?