Re: Other Globals in %once

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

> Calling set_global does the assignment right there and then, so it 
> should
> in fact be available in <%once> or anywhere else inside the component.

Interesting. The errors we're getting are when we try to compile a 
component:

     my $interp = HTML::Mason::Interp->new(
         'allow_globals' => [qw($story
                                $burner
                                $writer
                                $element)]
         'in_package'    => TEMPLATE_BURN_PKG
         'comp_root'     => $self->get_comp_dir,
         'data_dir'      => $self->get_data_dir,
     );

     my $comp = eval { $interp->make_component(comp_source => $data) };

However, the $story, $burner, $writer, and $element objects aren't 
actually assigned. This has never been a problem, because we're not 
executing the component, just compiling it. Does the %once block 
actually get executed by make_component()? If so, need it be? And if it 
must be, well, I guess I'll have to figure out a way to make mock 
objects to assign to those globals. Which would be a PITA.

The globals are of course always assigned to when executing a component.

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.