2009/10/12 Octavian Râşniţă <orasn...@gmail.com> > Hi, > > Is it possible to define a macro in a single place and access it in all the > templates? > > For example, I want to create a macro for translation, which would be > needed > in all the templates and it would be nice if it wouldn't be necessary to > define it in every template. > > This seems to work:
use Template; use Template::Context; my $context = Template::Context->new; $context->process(\'[% MACRO foo GET 42 %]'); my $template = Template->new({ CONTEXT => $context }); $template->process(\'[% foo %]'); --Sean
_______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates