perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cory 'G' Watson" <gp...@loggerithim.org>
Subject Re: Odd Reload Behavior
Date Sat, 16 Aug 2003 05:46:18 GMT

On Friday, August 15, 2003, at 06:23  PM, Ged Haywood wrote:
>> Ignore syntax errors and lack of declarations, as I just threw that
>> together from memory
>
> The guesswork would be a lot easier if it didn't involve so much 
> guesswork. :)

I think the root question of my email was lost in my poor explanation.

Basically, I have a module (which I called App) that has something like:

%somehash = ();

This declaration is outside of any subroutines.  VirtualHosts then call 
App->load("name", "libdir") to fille $somehash{$name} with a hashref of 
page objects.  All logging led me to believe that this variable was 
being properly populated, but when that variable was accessed (via 
getApp($name)), %somehash was undef.

Silly mistakes aside, I was basically trying to create a 'global' 
variable that was populated by a method call _after_ it was 
require()ed.  The problem comes from the module being loaded _twice_.  
The second time, %somehash = () sets things back to undef, but 
loadApp() is not called again.

My motive for questioning the list was to find out if Apache's 'will 
this survive a SIGHUP' pass caused this behavior, or if it was 
something else I was missing.

I re-attacked this problem by adding a caller() check in App, and it 
proved to me that App was indeed being loaded twice.  Once by my 
startup.pl (use App ();), and _again_ by an eval.  caller() couldn't 
point me to the spot of code that was doing this, other than telling me 
it was a 'require App;'.  I started flipping switches and localized it 
to PerlFreshRestart being on.  When I turn it off, the eval() happens 
_before_ my startup.pl use() and subsequence call to App->load().

So this long-winded explanation is for the archives, and also to get an 
idea as to why this happens.  Thanks! :)

Cory 'G' Watson



Cory 'G' Watson
http://www.loggerithim.org



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Mime
View raw message