http://www.perlmonks.org?node_id=235075

alfie has asked for the wisdom of the Perl Monks concerning the following question:

I have a real strange DBI problem. I'm using DBIx::Abstract for constructing a search function over a message board, but somehow it gives me a real strange error message:

execute called with 2 bind variables when 0 are needed

Has anyone seen this before? This is the code which I am using:

my @what = split(/\s+/, $what); shift @what if $what[0] eq ''; # skip leading empty fields my $first = 1; foreach (@what) { push (@$where, 'AND') unless $first; push (@$where, [ { subject => ['LIKE', "\%$_\%"] }, 'OR', { message => ['LIKE', "\%$_\%"] }, ]); $first = 0; } $dbx->select({ fields => 'reference, subject, name', table => 'boardmessage', where => $where, });

I can't see any mistake in here, still it gives me the above error message. In the debug I found this thing:

DBIx::Abstract::__literal_query('DBIx::Abstract=HASH(0xb92e080)', 'SEL +ECT reference, subject, name FROM boardmessage WHERE ((subject LIKE ? +) OR (message LIKE ?))', '%huhu%', '%huhu%') called at /usr/share/per +l5/DBIx/Abstract.pm line 769

This leave me even more wondering, for there are two ? in the query and two bind values, so I am really wondering where the thing is bailing out? Did I hit a strange error in the module, or am I having something wrong? Please enlighten me, I'm out of ideas here...
--
use signature; signature(" So long\nAlfie");