Text::Thread - format threaded items to ascii tree
use Text::Thread; my @tree = ( { title => 'test1', child => [{ title => 'test2', child => [{ title => 'test5' }, { title => 'test3'}]}]}, { title => 'test4' } ); my @list = Text::Thread::formatthread ('child', 'threadtitle', 'title', \@tree); print "$_->{threadtitle}\n" foreach @list;
Text::Thread formats a tree structure into a ascii tree, which is often used in threaded mail and netnews reader.
format the given TREE. CHILD is the hash key for child nodes in the items in TREE. it could be either arrayref or hashref. THREADTITLE is the key for the output ascii tree in each node. TITLE is the thing to be put at the leaves of the tree.
It doesn't work if the depth of the tree is more than 32.
Chia-liang Kao <clkao@clkao.org>
Copyright 2001,2006 by Chia-liang kao <clkao@clkao.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Text::Thread, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Thread
CPAN shell
perl -MCPAN -e shell install Text::Thread
For more information on module installation, please visit the detailed CPAN module installation guide.