On Wed, 27 Aug 2003, Andy Wardley wrote:
> And now for the MACRO:
>
> [% MACRO mm(list) INCLUDE mm %]
nice, I wrote a lot of macros in these days, but sometimes virtual
variables (which resembles a lot object methods) are more satisfying.
It would be nice is one could call a macro as a virtual variable and
vice-versa, like the following stuff at perl level:
use Template;
use Template::Stash;
my $vars = {
mm => \&mm,
};
$Template::Stash::LIST_OPS->{ mm } = \&mm;
$template = Template->new;
print $template->process(
\'[% a= [1,2]%] virtual variable: [% a.mm %]; function: [% mm(a)%]',
$vars
);
(mm is any list method)
--
Franco Bagnoli (franchino) <[EMAIL PROTECTED]> ([EMAIL PROTECTED])
virtual location: Dipartimento di Energetica "S. Stecco"
real location: Dip. Matematica Applicata "G. Sansone", Universita' Firenze,
Via S. Marta, 3 I-50139 Firenze, Italy. Tel. +39 0554796422, fax: +39 055471787
GPG Key fingerprint = 169D 9EA5 8FD3 7EDA E43A 9830 255F BCEC 0D63 3728
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates