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

Matt S Trout dbix-class at trout.me.uk
Tue May 15 22:50:40 GMT 2007


On Tue, May 15, 2007 at 10:31:16PM +0200, Bernhard Graf wrote:
> Matt S Trout wrote:
> 
> > On Sun, May 13, 2007 at 10:25:16PM +0200, Bernhard Graf wrote:
> > > 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.
> > >
> > > Objections?
> >
> > I'm now convinced.
> >
> > Patch and test please, if you get 'em in by the end of the week we
> > can try it for the 08 rc cycle and see if it breaks anybody's code.
> 
> Looking at the code brings me to this question:
> 
> Shouldn't next() and single() return undef instead of empty list for 
> "not found" too?

Try it. If it doesn't fail any tests, write ones that fail without it and
we can ship it and see. Worst case we then unmerge part of your patch and
invert the sense of the tests to ensure future generations of DBIC hackers
don't make the same mistake :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list