I'm not sure about why it behaves this way, but the mod_perl guide forewarns
that "Evil things might happen when using PerlFreshRestart"

check out

http://perl.apache.org/guide/troubleshooting.html#Evil_things_might_happen_w
hen_us

which lists the relevant code...

maybe it has to do with the order in which stuff is held in %INC - that is,
Apache::DBI needs to be loaded before DBI, but PerlFreshRestart may require
them in the improper order because of the hash order?

--Geoff

> -----Original Message-----
> From: Tim Bunce [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, December 02, 1999 7:07 PM
> To:   Michael Smith
> Cc:   mod_perl mailing list; Tim Bunce; Doug MacEachern
> Subject:      Re: PerlFreshRestart and %INC
> 
> 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.

Reply via email to