JSON::JOM::Plugins::TreeUtils - add tree methods
This JOM plugin adds the following method to JOM objects and arrays:
hasDescendent($x) - returns true if $x is a descendent of the current node.
hasDescendent($x)
hasChild($x) - returns true if $x is a direct child of the current node. This should be faster than looping through values.
hasChild($x)
values
getDescendentsByType($type) - list of descendent nodes where typeof is $type. $type may be '*'. Returns results in depth-first order.
getDescendentsByType($type)
typeof
getChildrenByType($type) - list of child nodes where typeof is $type. $type may be '*'.
getChildrenByType($type)
It adds the following method to all JOM nodes:
hasAncestor($x) - returns true if $x is an ancestor of the current node.
hasAncestor($x)
Please report any bugs to http://rt.cpan.org/.
JSON::JOM, JSON::JOM::Plugins.
Toby Inkster <tobyink@cpan.org>.
Copyright 2010-2011 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install JSON::JOM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JSON::JOM
CPAN shell
perl -MCPAN -e shell install JSON::JOM
For more information on module installation, please visit the detailed CPAN module installation guide.