TPath::Index - tree-specific database
version 1.007
my $f = MyForester->new; # hypothetical forester for my sort of tree my $root = next_tree(); # generate my sort of tree my $index = $f->index($root); # construct reusable index for $root
A cache of information about a particular tree. Reuse indices to save effort.
The chief function of an index is to enable an expression to map a node to its ancestors for those trees that provide this mapping themselves. All tree-specific caches belong here, though.
You should regard the methods and attributes of a TPath::Index as private. The public function of an index is to be the optional second argument of a TPath::Expression's select method.
select
The map from ids to nodes.
The root of the indexed tree.
Expects a node. Returns whether this node is the root of the tree indexed by this index.
Cause this index to walk its tree and perform all necessary indexation.
Expects a node and returns the parent of this node.
Record the link from child to parent. If this index is unnecessary for a particular variety of tree -- nodes know their parents -- then you should override this method to be a no-op. It assumes all nodes are references and will throw an error if this is not the case.
Returns the unique identifier, if any, that identifies this node. This method delegates to the forester's id method.
id
The TPath::Forester that generated this index.
David F. Houghton <dfhoughton@gmail.com>
This software is copyright (c) 2013 by David F. Houghton.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
Unknown directive: =attribute
To install TPath, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TPath
CPAN shell
perl -MCPAN -e shell install TPath
For more information on module installation, please visit the detailed CPAN module installation guide.