in reply to message board thread quandary

Interestingly enough, i was recommended DBIx::Class::Tree by Matt Trout. Even more interesting is it seems to combine both shmem and clinton's ideas using a tree and a separate table for relationships as clinton mentioned.

I'm not too familiar with trees however, or this module for that matter. Any suggestions on how I might go about utiliziting it? There's some code in the docs that looks like this:

#!/usr/bin/perl use My::Employee; my $employee = My::Employee->create({ name=>'Matt S. Trout' }); my $rs = $employee->children(); my @siblings = $employee->children(); my $parent = $employee->parent(); $employee->parent( 7 );
Seems simple enough, but I'm sure I'd have to do some fanaggling (sp?) to get it to suit my purpose. Ideas?

meh.

Replies are listed 'Best First'.
Re^2: message board thread quandary
by GrandFather (Saint) on Sep 02, 2007 at 20:53 UTC

    It seems to me that if you add 'rootId' and 'date' fields to the 'replyTo' I used to build the tree here, then you can perform a date based fetch to get all new nodes, run through the fetched nodes to build a list of root nodes, then perform a fetch based on root node(s) to retrieve all the node information you need to build the tree.

    That avoids a second table and means you perform between two and the number of root nodes referenced in the time period plus one fetches - depending on how you structure your query.


    DWIM is Perl's answer to Gödel