<%shared> bug?

David Wheeler <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
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
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.