[ic] Leaky Globals in RPC mode

Mike Heins mikeh at perusion.com
Mon Dec 1 13:40:47 UTC 2014


Quoting Peter (peter at pajamian.dhs.org):
> On 12/02/2014 02:32 AM, Jon Jensen wrote:
> > This is by design; it's part of how PreFork mode works. It does not
> > reset all variables between each request as part of its ability to keep
> > working without reloading everything each time.
> 
> That's what I suspected.
> 
> > Any variables that you want to be global, in that they're available for
> > the whole page request but not between requests, should go into the
> > special %$::Instance hash.
> 
> Does the new $Tmp space get reset?  That would be more ideal for local
> (safe) code.
> 
> > See Vend::Server::start_page() and server_page() for how this gets
> > cleaned out between each page request.
> 

If you are in global space, you can use the Vend package for safe variables.
$Vend::something will get reset every time.

We also provide the $Instance hash for things which should be persistent
only for the current instance. And as was pointed out, $Tmp is good for
non-global stuff.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.253.4194  <mike at perusion.com>

"The secret of a good sermon is to have a good beginning and a good
ending, then having the two as close together as possible."
-- George Burns



More information about the interchange-users mailing list