Matt S Trout wrote:
> > do_something($alpha, $rs->find($id), $omega);
>
> I always do
>
> if (my $obj = $rs->find(...)) {
>
> for clarity.
You mean you'd do:
if (my $obj = $rs->find(...)) {
do_something($alpha, $obj, $omega);
} else {
do_something($alpha, $obj, $omega);
}
? Fortunately TIMTOWTDI. ;-)
> > So since find() is not designed to return lists, to be consistent
> > it should always return a single value: either a row object or
> > undef.
>
> Depends really - is it worth giving up consistency to support the
> poor programming practice exemplified above?
Why is that poor?
> Opinions welcome, I'm not -overly- troubled either way although by
> default I'd say the current conceptual consistency is the correct
> answer.
At least documentation should clarify the fact, that find() returns a
list of row objects, that either has 1 or 0 elements.
--
Bernhard Graf
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/