Skip to content

Instantly share code, notes, and snippets.

@willert
Created January 19, 2010 08:34
Show Gist options
  • Select an option

  • Save willert/280778 to your computer and use it in GitHub Desktop.

Select an option

Save willert/280778 to your computer and use it in GitHub Desktop.
package WuB::Schema::ResultSet;
use base qw/DBIx::Class::ResultSet/;
sub has_rows {
my $self = shift;
my @pk = $self->result_source->primary_columns;
my $first_row = $self->search( undef, {
select => \@pk,
rows => 1,
order_by => \'1'
})->next;
return $first_row ? 1 : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment