Im am considering using the MasonAllowGlobals option to avoid having to pass certain hashes to every function (the data is required all over the place).
 
I have noticed that, similar to programming directly in mod_perl, the global data survives the apache fork -- so if I set this in Apache httpd.conf
 
PerlSetVar MasonAllowGlobals "%siteData %siteConfig %privateData"
 
and then set this once:
 
$privateData{test} = 1;
 
That on subsequent reloads of that process, $privateData{test} can pop back up (if it hits the same forked process).
 
My question is -- is it safe to reset the global at the top of the autohandler? such as:
 
<%init>
%privateData = ();
</%init>
 
 -- this variable would only be alive to one fork at a time, right?
 
I suppose the thing I would have to be careful of is A) that I do this and B) make sure that any code that does not hit he autohandler does not use this data?
 
Thoughts?
 
Thanks
-John
 

Reply via email to