Re: Other Globals in %once
David Wheeler <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
On May 1, 2004, at 1:05 AM, Serge Sozonoff wrote:
> Thanks for this example and we agree that as long as the component is
> in memory the unless ($initialized++) {} block will not get executed
> again. Besides a restart of Apache, what else would cause the
> component get removed from memory? How for example would it get
> flushed from memory?
FYI, in Bricolage templates, the Mason interpreter only lasts for the
duration of a single burn. That means that the component is removed
from memory after burning a single story.
However, I've realized that you can use another approach that should
work just as well, as long as you take advantage of the change I'll
check in shortly. The change will allow the $burner object to be
available in %once blocks during the syntax check. The $story and
$element objects won't be during the syntax check, but all three will
be available during a story burn. So you'll shortly be able to do this:
<%once>
my @all_story;
unless ($burner->get_mode == SYNTAX_MODE) {
my %pub = $burner->get_mode == PUBLISH_MODE
? ( publish_status => 1)
: ();
@all_story = Bric::Biz::Asset::Business::Story->list(\%pub);
}
</%once>
I'll add something to the FAQ about this.
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