[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: non-Reinitialization of globals on recompile
From:       Bob <bobn () interaccess ! com>
Date:       1999-06-29 17:56:34
[Download RAW message or body]



As the person who opened this can of worms, I've the following comments.

> According to Doug MacEachern:
> > 
> > what don't you understand about "global"?  a global is global, an entry
> > in the Perl symbol table, not associated with any subroutine.  you need to
> > manage globals yourself, or let my() do it for you.
> > 

Then, On Tue, 29 Jun 1999, Leslie Mikesell wrote:
> 
> Is there really no way to pervert perl's namespaces into
> something that would allow destroying everthing outside of
> explicit packages between runs of registry scripts?  

Proof of the concept that not eveything that *can* be done *should* be
done. 

> Better yet,
> destroy any global changes between runs of ordinary registry
> scripts unless they do something to indicate they should be kept.

Making a variable global says it should be kept.  using my() says it
shouldn't (tho risks falling prey to the 'nested-subs-my-var-not-shared'
thing).

> One model that might work would be to have a registry variation
> that precompiles scripts that haven't been loaded yet, then
> forks before execution so subsequent variable changes are
> discarded.  The process sizes are so large that this might
> be a lot of overhead 

I guess.

> but it might turn out to be an overall
> win because you release the unwanted baggage malloc()'d during
> each run instead of accumulating it and judiciously pre-loaded
> things would tend to remain shared instead of becoming copies
> as each run modifies a few different pages in each httpd child.
> Has anyone tested an approach like this?
> 

This sounds seriously non-trivial to me.

My original issue was that globals weren't undef'd by *recompilation*, and
this was either not mentioned or was missed by my reading in the doc (the 
doc makes it abundantly clear that globals persist across requests to the 
same child). But once I understood this, it was easy to deal with.  I
think you're designing a tank to kill a mouse. 

- Bob N.

>   Les Mikesell
>     les@mcs.com 
> 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic