Class::DBI::Tree
In the ought to exist category, there ought to be a Perl module for automatically maintaining a tree structure using Celko’s modified pre-order traversal method. It’s not all that complicated, but it would be handy to have someone else build one. Key features
- your basic tree methods, insert, updated, remove (including either re-parenting, or trimming that branch), getChildren, getParent, pathToNode. All pretty easy with MPTM.
- multiple trees per table, none of the examples model this, but one tree per table is an edge case not the norm.
- be really nice if it did integrate smoothly with Class::DBI, nodes of the tree being Class::DBI objects, using the columns() method to identify primary keys, and lft and rgt columns.
- extra credit includes methods for balancing the tree, and support Celko’s suggestion to use ranges rather then sequential numbering for tables with frequent updates. (I’ve created a bugmenot account)