Re: <%shared> bug?
"Jonathan Swartz" <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
Looks like this is the culprit: package Bric::Util::Burner::Commands; I assume you're using the in_package parameter to set this? $m is defined before the component ever runs, but only in the default (HTML::Mason::Commands) package. This seems like a bug when using in_package in conjunction with the <%shared> section. Jon ----- Original Message ----- From: "David Wheeler" <[email protected]> To: "Mason Developers" <[email protected]> Sent: Tuesday, March 23, 2004 11:03 AM Subject: [Mason-devel] <%shared> bug? > Hi All, > > I've run into an issue with Mason templates in Bricolage. Given this > autohandler: > > Foo: <% $foo %> > <%shared> > my $foo = 'bar'; > </%shared> > > I get this error: qq{Can't call method "call_dynamic" on an undefined > value at autohandler line 7.}. Taking a look at the object file, I see: > > # MASON COMPILER ID: 2097!30608 > package Bric::Util::Burner::Commands; > use strict; > use vars qw($m $writer $story $element $burner); > HTML::Mason::Component::FileBased->new( > 'code' => sub { > $m->call_dynamic( 'main', @_ ) > }, > 'compiler_id' => '2097!30608', > 'dynamic_subs_init' => sub { > #line 2 /usr/local/bricolage/data/burn/sandbox/user_0/oc_1/autohandler > > my $foo = 'bar'; > return { > 'main' => sub { > local $Bric::Util::Burner::Commands::m = $HTML::Mason::Commands::m; > $m->debug_hook( $m->current_comp->path ) if ( %DB:: ); > > #line 1 /usr/local/bricolage/data/burn/sandbox/user_0/oc_1/autohandler > $m->print( 'Foo: ' ); > #line 1 /usr/local/bricolage/data/burn/sandbox/user_0/oc_1/autohandler > $m->print( $foo ); > #line 1 /usr/local/bricolage/data/burn/sandbox/user_0/oc_1/autohandler > $m->print( ' > ' ); > return undef; > }, > > } > }, > 'load_time' => 1080068401, > 'object_size' => 753, > > ) > ; > > So it looks like you can't call $m->call_dynamic('main') because main > hasn't been run yet, and it is main that assigns to $m. > > Any idea how this is happening? The %shared blocks in the Bricolage UI > code seem to work fine. > > Thanks, > > David > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Mason-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mason-devel > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click