Bill Moseley wrote:
Any way to get to the stash from a virtual method?  That is:

    [% some_var.some_vmethod %]

Then in some_vmethod() I'd like to have access to the stash.



I'd say your best bet is to do one of the following.

1) Create a global variable and store the context to the variable before the 
process. Then you can use that global inside of the virtual method.

ie:
my $template = Template->new();
$BlahPackage::tt_context = $template->context();
# (if you are processing from main use: $::tt_context = xxx)
# you can then use $::tt_context to do all that you need to I think
$template->process();


2) Use a filter instead and do: [% some_var | some_filter %]
Filters provide the context for you, so you might be all set there.

-- Josh Rosenbaum

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to