my ($hashed_passwd) = 'a_complicated_salted_password'; my $agent = master->resultset('Agent')->search({ user => params->{login}, pass => $hashed_passwd, })->single; if ($agent) { return Dumper($agent->profilo); } else { return 'hard error'; }