[Dbix-class] DBIx::Class::SingletonRows

David Cantrell david at cantrell.org.uk
Mon Jun 30 21:46:04 BST 2008


On Mon, Jun 30, 2008 at 11:36:33AM -0500, Jonathan Rockway wrote:

> I like this.

Thankyou!

>               People are constantly whining how singleton rows or
> non-singleton rows are the One True Way, and everything that disagrees
> with them is WRONG!!11!  Now users of DBIC can pick for themselves
> instead of being told what to think :)

Just as long as they *do* think I don't care what they think ;-)

> * On Wed, Jun 25 2008, David Cantrell wrote:
> > Unlike the earlier versions, this one is a proper component and is only
> > slightly magical.
> I'm a bit unclear on this part:
>
> > sub magick_object {
> >     ...
> > }
> Is there a reason why you have to fake inheritance here?

I need to control my ref-counting so I don't leak memory, but I found
that if I did real inheritance and just provided my own DESTROY it
didn't work right.  Something inside DBIx::Class (and I didn't get as
far as figuring out what, as it was quicker to do an Evil Hack) was
getting in the way.  Hence me wrapping the real object inside another
object, one which DBIx::Class doesn't "know" about, and so won't mess
things up.  The *counting* part of ref-counting was working, but
deleting the object was spitting out some error that I forget now.

It's ... hard to explain, unfortunately.  And I might just have missed
something really obvious.

I did try weakening references and whatnot, but either it wasn't what I
needed or I used it wrong.  Either way, it didn't do the trick.

> Perhaps I'm missing something, but I think other people are probably
> wondering the same thing.  (As an aside, whenever you have to have a
> long comment explaining why you do something, it's probably not the best
> approach ;)

Oh I dunno, first time I saw a Schwartzian Transform I really wished
there was a nice long comment with it!  But I do see where you're coming
from.  Another reason that it's probably not the best approach is that
it feels just plain dirty.

-- 
David Cantrell | Reality Engineer, Ministry of Information

There is no one true indentation style,
But if there were K&R would be Its Prophets.
Peace be upon Their Holy Beards.



More information about the DBIx-Class mailing list