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.
If you understand the problem, you can work around it (by using
a closure or by passing and returning values properly), but it's
better to avoid the problem altogether and define your subs in the
<%once> section. Better still, consider making your subroutine
a separate component or subcomponent.
By the way, there is a dedicated mailing list for Mason at:
http://netizen.com.au/mailman/listinfo/mason
Jon