Tree::Simple::View::ASCII - A class for viewing Tree::Simple hierarchies in ASCII
use Tree::Simple::View::ASCII; my $tree_view = Tree::Simple::View::ASCII->new($tree); $tree_view->includeTrunk(1); print $tree_view->expandAll(); # root # |---Node Level: 1 # | |---Node Level: 1.1 # | |---Node Level: 1.2 # | | |---Node Level: 1.2.1 # | | \---Node Level: 1.2.2 # | \---Node Level: 1.3 # |---Node Level: 2 # | |---Node Level: 2.1 # | \---Node Level: 2.2 # |---Node Level: 3 # | \---Node Level: 3.1 # | |---Node Level: 3.1.1 # | \---Node Level: 3.1.2 # \---Node Level: 4 # \---Node Level: 4.1 print $tree_view->expandPath("root", "Node Level: 1", "Node Level: 1.2"); # root # |---Node Level: 1 # | |---Node Level: 1.1 # | |---Node Level: 1.2 # | | |---Node Level: 1.2.1 # | | \---Node Level: 1.2.2 # | \---Node Level: 1.3 # |---Node Level: 2 # |---Node Level: 3 # \---Node Level: 4 my $tree_view = Tree::Simple::View::ASCII->new($tree, ( characters => [ indent => " ", pipe => " | ", last_branch => " \- ", branch => " |- " ] ) ); # root # |- Node Level: 1 # | |- Node Level: 1.1 # | |- Node Level: 1.2 # | | |- Node Level: 1.2.1 # | | \- Node Level: 1.2.2 # | \- Node Level: 1.3 # |- Node Level: 2 # |- Node Level: 3 # \- Node Level: 4
This is a Tree::Simple::View subclass which provides simple ASCII formatting for trees.
I had this code lying around, and I figured it was best to put it into here. This is an early release of this, and it lacks configuration parameter handling, but that can be easily added later when I need it.
This will draw a fully expanded tree.
This currently is aliased to the expandAllSimple since we don't have config handling.
expandAllSimple
This will draw a tree with the given @path expanded.
@path
This currently is aliased to the expandPathSimple since we don't have config handling.
expandPathSimple
Config handling, allowing you to customize the drawing. Patches welcome, I just don't currently have the time to add it.
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.
stevan little, <stevan@iinteractive.com>
Copyright 2004-2008 by Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Tree::Simple::View, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tree::Simple::View
CPAN shell
perl -MCPAN -e shell install Tree::Simple::View
For more information on module installation, please visit the detailed CPAN module installation guide.