I'm sure this is answered somewhere in the docs, but I can't find it (I'm curious why Google returns no matches when doing a site: search on http://template-toolkit.org).
When I use a Template Toolkit plugin -- [% USE my_plugin %] -- how can a plugin determine its own name? I am building stuff that uses plugins in some strange ways and it would be helpful if a plug can "self-identify". I started out by doing something like the following:
[% USE my_plugin "some_identifier" %]
However, having to pass that identifier every time means a chance for a typo every time. Further, if a plugin presents a form and later handles the form data (these are Web-based apps I'm working with), I need it to be able to send the user to another page with the same plugin handling the data. Passing the ID in the template means I have to synchronize the ID across templates: not good. Hard-coding the ID into every plugin means one more thing that programmers have to remember, so that's also not a good alternative.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to Runtime determination of TT plugin name by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |