Re: Other Globals in %once

Dave Rolsky <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Sat, 1 May 2004, David Wheeler wrote:

> No, I mean that $m is available but undefined in %once blocks. If what
> Dave tells me is correct, then other globals created by allow_globals
> and set_global() are already assigned before the %once block executes,
> so ignore the "other globals" part. So yes, I'm referring to loading
> the component before the globals are defined.
>
> $m and $r are undefined in %once blocks, and I'm not sure the reasons
> for that are compelling enough. Seems to me that the Perl way is to
> allow the flexibility to use them, with the caveats well documented.
> IOW, give Masonites enough rope to shoot themselves in the foot. ;-)

Actually, I thought of a compelling reason that this won't go into the
current stable branch, at least ;)

The changes to make this work would require a bit more code surgery than
I'd like.  Specifically, we currently set the $m variable in
Request->exec.  To make it available in <%once>, we'd have to set it in
the Interp object instead, and I'm not sure where.  It could be in load(),
but then it'd get reset every time a new component is loaded, which can
happen multiple times in a request.  Also, we'd need to think about this
should work in the face of subrequests.

So while I'm not entirely opposed to this, I don't think it's something
that can go in the stable branch.

BTW, $r _is_ available, since it's set by ApacheHandler, using
$interp->set_global, much earlier.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.