[Dbix-class] Designing a system with DBIx::Class

Peter Edwards peter at dragonstaff.com
Sat May 2 18:03:19 GMT 2009


2009/5/2 Matt S Trout <dbix-class at trout.me.uk>

> On Fri, May 01, 2009 at 04:19:32PM -0700, Morgon Hed wrote:
> > What I want is a way to "lazily" only load those objects from the
> database that are actually needed to process a message and so ideally I
> would like each object to be able to get a ref to another in a uniform way
> without having to know wether or not the object has already been loaded...
>
If you always traverse the graph in the same direction you can generally
> avoid
> loading things more than once anyway - but the other thing is to keep a
> hash of objects yourself, and just forcibly destroy them on end of request
> -
>

I've had success using Graph to build directed graphs of unique objects from
DBIC
http://search.cpan.org/perldoc?Graph
I used it for authorisation role inheritance trees as I wanted the SQL to be
portable beyond Oracle's SQL tree extensions.
I got the idea from some "incomplete XML" path matching code but the same
technique should work.

Regards, Peter
http://perl.dragonstaff.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090502/ba6=
a889b/attachment.htm


More information about the DBIx-Class mailing list