On Fri, 4 Aug 2000, Keith G. Murphy wrote:

> Stas Bekman wrote:
> >  
> > I think you confuse,
> > something. When the script is recompiled all the variables belonging to
> > the package decalared by Apache::Registry or similar are getting reset. If
> > you require/use() some modules that declare packages and have global
> > variables -- these won't be reset unless reloaded or initialized in your
> > code.
> 
> OK, we've lost my original question here, but what I was saying was
> this:
> 
> I have a script that is in Apache::Registry.  (It's showing up in
> "Compiled Registry Scripts" in perl-status).
> 
> The global variables are *not* getting set on recompilation.  Are you
> saying they should?

In your original email you've said that the variables don't get reset on
recompilation.

The variables are set when you set them, either every time in the script
when this executed, or in the BEGIN block once as you have mentioned
below (under Apache::Registry).

> > > > *You* have straightened me out, on the other hand.
> > > >
> > > > So, lessee, BEGIN { somevar=somevalue; } ought to work for a variable I
> > > > want reinitialized at compilation only...
> > 
> > Not if you are talking about the scripts running under Apache::Registry
> > and friends, please read the guide.
> > http://perl.apache.org/guide/porting.html#BEGIN_blocks
> > 
> Stas, what are you talking about?  Your own guide says:
> 
> "BEGIN blocks in Apache::Registry scripts will be executed, as above
> plus: 
>               ...
> An additional time, once per child process, each time the script file
> changes on disk. "
> 
> I.e., at compilation.  And that is what I'm seeing, and it's the
> behavior I want.
> 
> I think you are confused about what I am saying.  Probably working too
> much on the template guide...  :-)

Brrgghhh,  I guess we were talking about different things.... I thought
you were trying to initialize in the code. Apparently I misread your
quote. Sorry about that.

Never mind, BEGIN { somevar=somevalue; } does what you want, great!!!


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://perl.org     http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org


Reply via email to