The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WE::Util::GenericTree - generic class for tree representations

SYNOPSIS

    $tree = new WE::Util::GenericTree $data

DESCRIPTION

new

    $tree = new WE::Util::GenericTree $data

Construct a new GenericTree object with content $data.

reparent

    $tree->reparent($newparent)

Use this method only if there is already a parent. Otherwise, use the parent method.

root

    $root = $tree->root;

Return root node of the given $tree.

modified

    $modfied = $tree->modified

Return true if the tree is modified, that is, one of root's #' subtrees are modified.

    $tree->modified($modified)

Set the modified attribute (0 or 1) for the root tree.

subtree

    $root->subtree([$tree1, ...]);

With a $tree defined, put the trees as subtrees of $root. Without $tree, return either an array of subtrees (in array context) or a reference to the array of subtrees (in scalar context).

The argument can be either GenericTree objects or another scalars, in which case they will be used as the data argument to the constructor of GenericTree.

Alias: children.

find_by_pathname

    $tree = $root->find_by_pathname($pathname);

Search and return the corresponding $tree (or undef if no such tree exists) for the given $pathname.

separator

    $separator = $tree->separator

Return the separator for this tree. Defaults to /.

    $project->separator($separator);

Set the separator for this tree to $separator.

HISTORY

This module before version 1.04 had the misnamed undocumented method eventually_construct which is renamed to maybe_construct.

COPYRIGHT

Copyright (c) 1995-2000 Slaven Rezic. All rights reserved. Copyright (C) 2000,2002 Online Office Berlin. All rights reserved. Copyright (c) 2002,2004 Slaven Rezic. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.