[Catalyst] NULL search vs empty string search in C::C::DBIC::API

Seth Daniel catalyst at sethdaniel.org
Wed Mar 16 01:32:22 GMT 2011


Hi,

An interesting problem with Catalyst::Controller::DBIC::API (2.003001).
Anyone else using it?

A) This query string: search.no_arg=&search.argA=1 will end up performing an 
   SQL search like: no_arg = '' AND argA = 1.

B) This query string: search.no_arg&search.argA=1 will end up performing an 
   SQL search like: no_arg is NULL AND argA = 1;

So my question is, using the common tools (in particular URI), how do you
generate a query string that looks like B?

The following code:

my $uri = URI->new( 'http://somplace.com' );
$uri->query_param( 'no_arg' => undef );
$uri->query_param( 'argA' => 1 );

generates a URL like A.  I cannot figure out how to generate a URL like B.
The various URI utilities always assume key/value pairs.

This also makes me wonder if this is a bug in C::C::DBIC::API.  Doesn't 
it seem like a NULL search should be generated from both B *and* A? 
(a quick test shows that $uri->query_param( 'no_arg', '' ) also
generates a URL like A, so maybe a NULL search for both B and A is bad).

-- 
seth /\ sethdaniel.org



More information about the Catalyst mailing list