[Dbix-class] Return value of DBIx::Class::ResultSet::find()

Peter Edwards peter at dragonstaff.com
Mon May 14 17:53:33 GMT 2007


>> C'mon people, pitch in with arguments and opinions
>
>I'm personally attached to the following syntax:
>
>my $result = $dbic->resultset('MyApp')->find(xxx) ||
>$self->throw('Not Found Type Error');

+= 1

The common cases I use are: find_or_create(),find(), search or search_rs().
Generally if I use find() it's because I already have a key. If it fails it
means a data inconsistency and that's something I want to know about via an
exception rather than passing an undef into a subroutine and hoping lower
code layers are bullet-proof.

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com  Business IT Consultancy




More information about the Dbix-class mailing list