On Fri, 2005-04-15 at 23:46 +0200, Rick Jansen wrote:
> 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.

What you have below will call run() during startup.  All the code
outside of subs in your Application module is going to get run the first
time you use() the 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

- Perrin

Reply via email to