Hello David,

>  i want to built a recurrent function...
> I�ts possible built functions with template toolkit?

I take it you mean a recursive function. You are probably
better off writing the recursive function in Perl and
passing it in the parameter hash to the template processor.
Something like this:

     #!/usr/bin/perl -w

     use strict;
     use Template;

     sub recursive_func {
         my $val = shift;
         return 0 if $val <= 0;
         return 1 if $val == 1;
         return $val + &recursive_func($val-1);
     }

     my $tproc = Template->new();
     $tproc->process(\*DATA, {
         recursive_func => \&recursive_func,
     }) || die $tproc->error;

     __DATA__
     [%- recursive_func(4) -%]


HTH, Hans

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

Reply via email to