Quick question that I've been meaning to ask for some time.
I've had situations where I need to pass data to a template plugin that I don't want the template to have direct access to. I've done this by passing a "private" variable with a leading underscore to process:
$tt->process($relative_path, { _private => $foo }, \$output);
and extracted it directly from the stash hashref in the plugin module:
my $foo = $self->{_context}->stash->{_private};
Since the Template::Stash docs say:
The Template::Stash module defines an object class which
is used to store variable values for the runtime use of
the template processor. Variable values are stored inter-
nally in a hash reference (which itself is blessed to cre-
ate the object) and are accessible via the get() and set()
methods.The fact that the stash is a hashref of the variables passed seems documented. However, doing this still seems slightly evil to me.
Is this okay? Is there a better way of passing stuff to plugins without them being accessible in the template.
Cheers,
Adrian
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
