DBIx::Class::NotFound

勉強会用でつくったので。


package DBIx::Class::NotFound;
use strict;
use warnings;
use base qw/DBIx::Class/;
our $VERSION = '0.01';
__PACKAGE__->load_components(qw/ResultSetManager/);
sub found_or_notfound : ResultSet {
my $self = shift;
my $it = $self->search(@_);
return unless $it->first;
$it->reset;
return (wantarray ? $it->all : $it);
}
1;