my $dyn_sql_maker = Some::Class->new( type => $cgi->param('type'), id => $cgi->param('id'), # etc ... ); my $sql = ''; $sql .= $dyn_sql_maker->select_clause . " Report-specific static SQL here "; $sql .= $dyn_sql_maker->from_clause . " Report-specific static SQL here "; $sql .= $dyn_sql_maker->where_clause . " Report-specific static SQL here "; $sql .= $dyn_sql_maker->groupby_clause . " Report-specific static SQL here "; # Do something with the SQL