Text::Tree

Format a simple tree of strings into a textual tree graph
Download

Text::Tree Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ron Isaacson
  • Publisher web site:
  • http://search.cpan.org/~isaacson/

Text::Tree Tags


Text::Tree Description

Format a simple tree of strings into a textual tree graph Text::Tree is a Perl module that allows the caller to develop a tree structure, using nested arrays of strings and references. Once developed, the whole tree can be printed as a diagram, with the root of the tree at the top, and child nodes formatted horizontally below them.The string labels are printed as-is, or optionally surrounded with a simple outlining style using printable ASCII characters.This module may be used with object-oriented or simple function calls.SYNOPSIS use Text::Tree; my $tree = new Text::Tree( "root", , , ] ); print $tree->layout("boxed"); __OUTPUT__ +----+ |root| +----+ .---^---. +----+ +-----+ |left| |right| |node| +-----+ +----+ .-^-. +-+ +-+ |1| |2| +-+ +-+METHODSnew() my $tree = new Text::Tree( "label", ], );Create a new tree object from a nested set of array references. The first element of each array must be a string used as a node label. The remaining elements must each be an array reference for a child of the node. Labels may contain newlines to support multiple lines of text.layout() my @lines = $tree->layout( "centered in boxes" ); print @lines;Lays out the tree into an array of newline-terminated strings, ready for printing or displaying. The optional style argument may contain various keywords such as 'center', 'box', 'line', 'oval' and/or 'space'. These style keywords affect how the tree nodes are formatted. Requirements: · Perl


Text::Tree Related Software