Hello everybody,

is there a way to implement macros as subroutines ?
what i want to do is the following:

my $template = new Template({
   PRE_DEFINE => {
      exec => \&myexec
   }
});

sub myexec {
   my $context = shift;
   my $stash = $context->stash();
   # do some stuff here and set variables in $stash
}

in my template i have the following definitions:
[% MACRO exec INCLUDE exec %]
[% exec(name = 'mythingtoexecute') %]

this is working fine, what i want to have is that i have not to make the
macro definition, so that in my template
[% exec(name = 'mythingtoexecute') %]

does just the same as above ... 

thanks in advance

gernot



Gernot Homma
Cyber-Atelier
Shuttleworthstr. 4-8/Objekt 50
fon: +43 1 272 92 51 6
fax: +43 1 272 92 51 9
mail: [EMAIL PROTECTED]
 

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to