> If you need this kind of thing often enough, you could define lt (and
> gt, for that matter) as function refs in your perl script and pass them
> in as variables:
>
> #!/usr/bin/perl
> use Template;
>
> my $func = {
>         'lt' => sub { $_[0] lt %_[1] },
>         'gt' => sub { $_[0] gt %_[1] },
> };
>
> my $tt = Template->>new();
> local $/ = undef;
> $tt->>process(<DATA>, $func);
>
> __DATA__
> [% IF func.lt('2004-11-23', '2004-11-26') %]
> Good
> [% END %]

Thanks, Jason. I've added 'eq', 'lt', 'gt' in my script.
Interesting, why these functions are not part of the TT,
maybe it involves to hack the parser a lot ?
Besides this tiny awkwardness, I'm very pleased with TT :)

Thanks all.


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

Reply via email to