in reply to Module to ease query building

You may be able to use SQL::Abstract for that. You may wind up with something like:

my %where_clause = (); if ( $cgi->param( 'field1' ) ) { # obviously, some validation should be here $where_clause{ 'field1' } = $cgi->param( 'field1' ); } # etc. my $sql = SQL::Abstract->new(); my ( $stmt, @bind ) = $sql->select( 'table', [ qw( field list ) ], \%where_clause ); my $sth = $dbh->prepare( $stmt ); $sth->execute( @bind );