I'm sorry to bother you with this, but I'm having some trouble with what
was a working template. The server version is running fine on TT 2.20 and
Template-DBI-2.65 (I think)
but when installed on my netbook with Template-Toolkit-2.22 and
Template-DBI-2.64 things go wrong.

The bit of template that seems to be failing looks like this.
[% INCLUDE header.tmpl %]
        <a href="/ssnewform.pl" target="_blank"> New </a>
    [% USE DBI( database = 'dbi:mysql:solsystest',
        username = 'solsys' ,
        password = 'w0kk4' )
    %]
<snip>
                [% sql %]
                [% main = DBI.prepare(sql) %] 
                [% bind = [] %]
                [% FOREACH actives = active %]
                        [% IF like.grep(actives).0 %]
                                [% likact = parms.$actives %]
                                [% bind.push("\%$likact\%") %]
                        [% ELSE %]
                                [% IF parms.$actives == 'ACTIVE' %] 
                                        [% bind.push('quote') %]
                                        [% bind.push('first') %]
                                        [% bind.push('happen') %]
                                [% ELSE %]      
                                        [% bind.push(parms.$actives) %]
                                [% END %]
                        [% END %]
                [% END %]
                Bind: '[% bind.0 %]' j '[% bind.1 %]'
                [% FOREACH customer = main.execute(bind) %]

<snip>

the [% sql %] line and "Bind: '[% bind.0 %]' j '[% bind.1 %]'" are 
debugging and can be safely ignored.

Now when the active array passed through from the perl script is empty
this fails with 

DBI error - execute failed: called with 1 bind variables when 0 are needed

If there's one item in the active array then it doesn't fail, but also
doesn't seem to be passing anything meaningful through to the mysql server
as nothing gets returned (my suspicion is it passes an array ref)

If active holds 2 or more you get

DBI error - execute failed: called with 1 bind variables when n are needed

where n is the number passed.

Thus it seems to me that rather than passing a list of vars with the 

                [% FOREACH customer = main.execute(bind) %]

I'm passing one, which as I said above I assume is a ref to the array.

So how do I deref this array, and why do I now need to.

thanks

M

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

Reply via email to