On Thu, Dec 02, 1999 at 06:59:26PM +0000, Michael Smith wrote:
> I'm experiencing difficulties when using PerlFreshRestart modules that
> depend on %INC. In my particular case I'm trying to use persistent
> connections in DBI through Apache-DBI, and Apache/DBI is not in %INC
> when PerlFreshRestart causes DBI to be loaded a second time.
>
> In more detail, I've cut down my config file to little more than
>
> PerlModule Apache::DBI
>
> And I've altered DBI.pm to Dump out %INC to STDERR just before it checks
> it to see if it contains Apache/DBI. With PerlFreshRestart not set I
> get this dumped out in my session.
> $VAR21 = 'Apache/DBI.pm';
> With PerlFreshRestart on, I get two dumps, one in my session window, and
> one in the error log; firstly:
> $VAR21 = 'Apache/DBI.pm';
> (just as above) and then in the error log.
> [...similar list but without Apache/DBI.pm...]
> Why does PerlFreshRestart behave like this? I don't understand why the
> module is loaded twice, and more particularly why %INC is different the
> second time. Oh, I suppose I should mention that this is with
> perl5.00404, apache/1.3.6 and mod_perl/1.19
And just to fill-in from the DBI perspective... near the top of DBI.pm
it says:
# check if user wants a persistent database connection ( Apache + mod_perl )
if ($INC{'Apache/DBI.pm'} && substr($ENV{GATEWAY_INTERFACE}||'',0,8) eq 'CGI-Perl') {
$connect_via = "Apache::DBI::connect";
DBI->trace_msg("DBI connect via $INC{'Apache/DBI.pm'}\n");
}
So the problem seems to be that when the DBI gets re-loaded by
PerlFreshRestart, %INC doesn't contain 'Apache/DBI.pm'. Presumably
because Apache::DBI hasn't been loaded (yet?).
So, as Mike says, any ideas why PerlFreshRestart behaves like this?
Tim.