I have next code:
#find contact with given email and/or phone
sub contact {
my( $self, $email, $phone ) = @_;
my $user = $self;
$user = $user->search({ email => $email }) if $email;
$user = $user->search({ phone => $phone }) if $phone;
return $user->first; # I think this is wrong
}
It it OK that in my ArtCoin::Schema::ResultSet::User
package to return Result
?
That depends on what you need. I prefix all methods returning ResultSets with 'search_' and all that return a single object 'find_'.