Re: Other Globals in %once

David Wheeler <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Apr 28, 2004, at 9:55 AM, Dave Rolsky wrote:

> The reason for not allowing these globals is that the <%once> block is
> only run once ;)
>
> So if a once block included this:
>
>   my $m = HTML::Mason::Request->instance;
>
> then this $m will stay in scope for a long, long time.  That would be 
> bad.

Well, if $m was a global in %once, no one would have to do that. 
Besides, it's clearly not just because you can access $m in %once that 
there's a risk of things staying in scope a long time. I could do this:

   my $dt = DateTime->now;

And I'd have a huge DateTime object in scope for a long time.

I suggest that the globals be allowed in %once, and that the 
responsibility for not adding things to memory for too long a time (and 
therefore for not creating what is effectively a memory leak) be left 
to the Mason developer, where it already is, anyway.

Just my $0.02.

Regards,

David



-------------------------------------------------------
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.