Ok, here's a more specific question.  Is there a way to generate an empty
result set?
For example, I want to test the search criteria and return an "empty" result
set (or undef) if it fails the test.

I guess this is one way, but it will mean an unnecessary trip to the
database:

sub search_rs {
    my ($self, $criteria, @rest )  = @_;

    return $self->validate_criteria( $criteria )
        ? $self->next::method( $criteria, @rest )
        : $self->next::method( { 1 => 0 } );
}


validate_criteria() is a bit ugly, but that's another story.





-- 
Bill Moseley
mose...@hank.org
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to