On 3/4/2010 12:51 PM, Gert Brinkmann wrote:
> I have implemented some classes and put one instance of them into the
> stash. Something like this:
>
> my $mine = MyClass->new();
> my %vars = ( mine => $mine );
> my $stash = Template::Stash::XS->new(\%vars);
> my $template = Template->new({
> ...
> STASH => $stash,
> }) || die Template->error(), "\n";
>
>
> Now my question: What is the best way to access the stash inside of a
> MyClass method?
>
> I could do something like this
> $mine->set_stash($stash);
> so I had it at hand inside of the $mine instance.
I would probably just do it that way. Your other choice is to provide a global
variable via "our" that allows access in MyClass.
-- Josh
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates