Perrin Harkins zee op 15/4/05 17:19: > Rick Jansen wrote: >> # crashes: >> my $DB_Object = new BerkeleyDB::Hash >> -Filename => $DB, >> -Env => $Env, >> -Flags => DB_RDONLY ... > > The rest of the flags here may be relevant. > >> To avoid name collisions the application is split in a main program >> calling a run-routine from a separate module > > Does one of these run before mod_perl forks? That would cause problems. > Maybe the one above gets loaded at startup?
No, that should not be the case, I think. The env-open and the "new BerkeleyDB::Hash" are actually called in the run routine, like below, simplified. Any idea why it does run as a required library, but not as a module? Application: use strict; use Appl::ApplMain; Appl::ApplMain::run(); Appl/ApplMain.pm: package Appl::ApplMain; my $Env; sub run { # Open env if not open $Env = new BerkeleyDB::Env if (! $Env); # crashes on second run if the close below is not done: my $DB_Object = new BerkeleyDB::Hash -Filename => $DB, -Env => $Env, -Flags => DB_RDONLY ... $Env->close(); undef $Env; # Else crash on 2nd run... } # run 1; -- Rick