GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Tree::Simple::View::ASCII(3) User Contributed Perl Documentation Tree::Simple::View::ASCII(3)

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.

expandAllSimple
This will draw a fully expanded tree.
expandAllComplex
This currently is aliased to the "expandAllSimple" since we don't have config handling.
expandPathSimple (@path)
This will draw a tree with the given @path expanded.
expandPathComplex
This currently is aliased to the "expandPathSimple" since we don't have config handling.

Config handling, allowing you to customize the drawing. Patches welcome, I just don't currently have the time to add it.

<https://github.com/ronsavage/Tree-Simple.git>

Bugs should be reported via the CPAN bug tracker at

<https://github.com/ronsavage/Tree-Simple/issues>

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.

2021-02-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.