Thanks for the idea. I went ahead and implemented this, and am very close.
I currently have a script looks at all the variables and undefines all of
them with a few exceptions (code copied from PerlRun.pm of mod_perl
source). The way that the exceptions are managed is that I keep a list of
the variables that I want to keep, and clear the variables that aren't on
the list out.

In the to-keep list, there's the obvious stuff (database and other base
libraries) but also I ran a blank script and kept all the variables
brought up in that blank list (Apache::*, &c.). This way I'm not clearing
stuff that I'm supposed to.

One issue that I have at this point is that although the script runs and
seems to do what it's supposed to do, it breaks stuff. If I go through
these steps

1) Start httpd
2) Run flushvars.cgi (nothing flushed, because it's clean)
3) Go to a cgi that loads a bunch of modules
4) Run flushvars.cgi (a bunch of stuff is flushed-- just the modules that
   were loaded in step 3)
5) Go to a cgi that uses a lot of the modules that were flushed in step 4
6) It breaks

I think it's trying to call a method for an object that doesn't exist
anymore. My guess is that I am keeping a certain variable that keeps a
list of the object in memory or something similar that I should really be
flushing. Because I'm protecting it, the list doesn't get refreshed. Does
anyone know the solution to this problem?

Thanks for your time-- this is really turning out a lot better than I had
initially hoped. Cc:: me on the reply because I am not subscribed to the
mod_perl mailing list.

Andrew Chen
Intern, Architecture
[EMAIL PROTECTED]
206-219-8445
The Cobalt Group, Inc. 

On Fri, 14 Jul 2000, Perrin Harkins wrote:

> On Fri, 14 Jul 2000, Andrew Chen wrote:
> > > You can actually do this from one place, iterating through a list of
> > > namespaces to flush.  Look at the code in
> > > Apache::PerlRun::flush_namepsace.  It's pretty easy.
> > 
> > We would still have to add code to every module, correct? Even though
> > there could be a central variable flushing module, all the other modules
> > would still want to call it. So although we may not be including the
> > flush_namespace code in every module, we will at least need to call them.
> 
> No, you just need to have one module that contains a list of the packages
> to flush and the code to do it, and then install that as a
> PerlCleanupHandler so it will automatically run after every request.
> 
> - Perrin
> 

Reply via email to