M wrote:
[SNIP]
>         [% FOREACH customer = main.execute(bind) %]
[SNIP] 
> But When I run it I get 
> 
> [Wed Nov 12 18:16:43 2008] [error] [client 92.41.135.118] DBI error -
> execute failed: called with 1 bind variables when 2 are needed, referer:
> http://test
> 
> I've been wondering if I need to declare bind somehow before I start
> pushing stuff onto it?
> 
> Or if I got the syntax of the execute right?


My guess is that the execute() routine does not handle an arrayref being passed 
and that is what TT uses for lists. So technically you are only passing 1 
parameter (an arrayref).

Possible Solutions:
*) Maybe create a deref virtual method and call execute like 
main.execute(bind.deref() ).
Code would be something like this:
$Template::Stash::LIST_OPS->{ deref } = sub {
  my $list = shift;
  return @$list;
};

*) Override/patch the execute routine so it can handle an arrayref.

-- Josh

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to