dtRdr::NoteThread - an n-ary tree of notes
my (@threads) = dtRdr::NoteThread->create(@notes);
Most of the methods from Tree::Simple have been aliased to a lowercase+underscores, terse naming convention (e.g. 'getParent' becomes 'parent', 'getDepth' => 'depth', 'getAllChildren' => 'children', etc.)
The thread id (getUID) is the note id.
Returns the note object (getNodeValue.)
If possible, use the aliases to work with this package. In the case that I find time to write Tree::Simpler, the javaLike names will vanish.
A notethread needs to pretend to be an annotation (in some contexts), so we implement these identifiers.
true
notethread
Sorts through a pile of notes and turns them all into threads.
The threads will be in arbitrary order.
Creates a dummy note. Copies all of the attributes from the descendant note (in the same thread), except the id and references.
my $note = dtRdr::NoteThread->dummy($id, $descendant);
See Tree::Simple.
my $thread = dtRdr::NoteThread->new($note, $parent);
Depth-first recursion. At each level, $sub is called as $sub->($node, \%ctrl).
The %ctrl hash allows you to send commands back to the dispatcher.
my $sub = sub { my ($node, $ctrl) = @_; if(something($node)) { $ctrl->{prune} = 1; # do not follow children } }; $tree->rmap($sub);
Eric Wilhelm <ewilhelm at cpan dot org>
http://scratchcomputing.com/
Copyright (C) 2007 Eric L. Wilhelm and OSoft, All Rights Reserved.
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.
The dotReader(TM) is OSI Certified Open Source Software licensed under the GNU General Public License (GPL) Version 2, June 1991. Non-encrypted and encrypted packages are usable in connection with the dotReader(TM). The ability to create, edit, or otherwise modify content of such encrypted packages is self-contained within the packages, and NOT provided by the dotReader(TM), and is addressed in a separate commercial license.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
To install dtRdr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm dtRdr
CPAN shell
perl -MCPAN -e shell install dtRdr
For more information on module installation, please visit the detailed CPAN module installation guide.