https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #13 from David Cook <dcook@prosentient.com.au> --- Honest question: Why do this: sub guarantor { my $self = shift; my $guarantor_rs = $self->_result->guarantorid; return unless $guarantor_rs; return Koha::Patron->_new_from_dbic($gaurantor_rs); } Instead of this: sub guarantor { my $self = shift; my $guarantor; my $guarantor_rs = $self->_result->guarantorid; if ($guarantor_rs){ $guarantor = Koha::Patron->_new_from_dbic($gaurantor_rs); } return $guarantor; } I admit that the latter has 3 more lines than the former, but the latter is way easier to read, easier to debug, and easier to add error-handling. Actually, that latter should probably double-check the output of Koha::Patron->_new_from_dbic() before returning. I've noticed a lot of Koha code directly returning the output of a method call, and it drives me crazy. We should do more data validation. It'll mean fewer bugs and easier maintenance. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.