[WM] Deferr and get_current_main_content()

jlm17 jlm17 at lucent.com
Thu Jun 24 18:32:54 IST 2004


I am trying to create a new wmk tag and I need access to the get_current_main_content() function. 
So, I have the tag call a handler that actually defers. The problem is, when it gets to the deferred 
function, get_current_main_content() returns an empty string. Does anyone know how to make this 
work? I'm working off of the navtree.pm file, but it wants to use OO, and I just want to call a 
simple function.

Here is my non-working code.
<webmake>
   <{perl
     sub tab
     {
       my ($perlcode, $tabname)=@_;
       my $this_content=$perlcode->get_current_main_content();
       #Problem is here! Shouldn't die, but does.
       die "dead" if($this_content eq "");
       return($this_content);
     }
     #Output a perl block whose execution will be deferred.
     sub deferr_tab
     {
       my ($tag, $attributes, $text, $self) = @_;
       $self->set_content($attributes->{name}, '<'.'{perl  tab($self'.", 
\"".$attributes->{name}."\",); }".'>');
       '';
     }
     define_empty_wmk_tag("tab", \&deferr_tab, ("name"));
   }>
   <tab name="product_family"/>
   <content name="index">xedni</content>
   <out name="index" file="test/dud.html">
     ${product_family}
     ${index}
   </out>


More information about the WebMake-Talk mailing list