Oleg Burlaca wrote:
> Thanks, Jason. I've added 'eq', 'lt', 'gt' in my script.
> Interesting, why these functions are not part of the TT,
I did add them at one point, but then realised that due to a limitation
in the parser, it meant that they had to be reserved words, and couldn't
be used as variables names. Some people (myself include) had templates
that got broken because of it, so I backed the change out again.
The problem is solved in TT3's superior parser which only looks for
operators where operators are expected, and doesn't require them to
be universally reserved words.
> maybe it involves to hack the parser a lot ?
Nope, it's easy. Just add the following lines to Template::Grammar,
around line 64:
%CMPOP = qw(
!= ne
== eq
+ eq eq
+ lt lt
+ gt gt
< <
> >
>= >=
Cheers
A
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates