On Thu, 6 Jul 2000, Jon Nangle wrote:
> In-Reply-To:
><[EMAIL PROTECTED]
> nchen.d>
> > Is there any harm in defining subroutines inside regular <%PERL> sections?
>
> You can do it if you want to, but it is a bad idea because
> once Mason has worked its magic, your sub will end up inside
> another sub. This is not usually a problem, but if you
> reference a variable inside your subroutine that was defined
> outside it, you'll get a "variable will not stay shared" error
> message. See the mod_perl guide for more information on this
> issue.
I figured out that much, and I've also been able to get rid of that error
message, either by using 'use vars' with the variables in question, or by
turning them into function arguments. But the real background of my
question is that I came across some strange behaviour in one of my
scripts: one of those variables (which is 'global' by use of 'use
var') is set by one subroutine and then passed (by reference) to another.
After some time (i.e. server uptime), that variable seems to loose its
value on its way from one sub to the other: I have verified that it is set
correctly, but inside the second function, it doesn't have any stored
values (it's a hash of arrays).
What I was wondering about is whether this strange behaviour is caused by
my subroutines being defined outside of <%ONCE> or whether there's another
explanation. Well, I guess I have to give it a try and rewrite the whole
thing...
> By the way, there is a dedicated mailing list for Mason at:
> http://netizen.com.au/mailman/listinfo/mason
Thanks for the link - I just subscribed to it.
Best regards,
Michael.
________________________________________________________
Michael | email: [EMAIL PROTECTED]
Hanisch |
________________________________________________________