> Gert Brinkmann wrote on 4 Mar 2010 1:51 PM...
>>
>> Now my question: What is the best way to access the stash inside of a
>> MyClass method?
Felipe Gasper (cPanel) wrote:
> It looks like you want to make a plugin, not something in the stash
> itself. Generally, the only thing that should access the stash directly
> is the stash itself.
I am not sure. Some thoughts:
A) AFAIK a plugin has to be initialised via "USE". I do not want that,
but simply offer some instances to the user. E.g. I have a web-page
class with the instance "page" in the stash. This class has the method
"title" to return the title of this web page. So in a template you
simply can use:
[% page.title | html %]
This works fine. So I think I am on the right track?
B) "the only thing that should access the stash directly is the stash
itself" I don't think so as the stash instance does offer the set/get
methods to access it. So I think it would be ok if a method in the class
"MyClass" would fetch the page instance via the stash:
my $page = $stash->get('page')
But maybe I am wrong.
Greetings,
Gert
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates