1Data::Grove::Parent(3)User Contributed Perl DocumentationData::Grove::Parent(3)
2
3
4

NAME

6       Data::Grove::Parent - provide parent properties to Data::Grove objects
7

SYNOPSIS

9        use Data::Grove::Parent;
10
11        $root = $object->root;
12        $rootpath = $object->rootpath;
13        $tied = $object->add_magic([ $parent ]);
14
15        $node = Data::Grove::Parent->new($hash [, $parent]);
16        $node_list = Data::Grove::ParentList->new($array [, $parent]);
17

DESCRIPTION

19       Data::Grove::Parent is an extension to Data::Grove that adds `"Parent"'
20       and `"Raw"' properties to Data::Grove objects and methods for returning
21       the root node of a grove, a list of nodes between and including the
22       root node and the current node, and a method that creates parented
23       nodes.
24
25       Data::Grove::Parent works by creating a Perl ``tied'' object that
26       contains a parent reference (`"Parent"') and a reference to the
27       original Data::Grove object (`"Raw"').  Tying-magic is used so that
28       every time you reference the Data::Grove::Parent object it actually
29       references the underlying raw object.
30
31       When you retrieve a list or a property of the Raw object,
32       Data::Grove::Parent automatically adds magic to the returned list or
33       node.  This means you only call `add_magic()' once to create the first
34       Data::Grove::Parent object and then use the grove objects like you
35       normally would.
36
37       The most obvious use of this is so you don't have to call a `"delete"'
38       method when you want to release a grove or part of a grove; since
39       Data::Grove and Data::Grove::Parent objects have no cyclic references,
40       Perl can garbage collect them normally.
41
42       A secondary use is to allow you to reuse grove or property set
43       fragments in multiple trees.  WARNING: Data::Grove currently does not
44       protect you from creating your own cyclic references!  This could lead
45       to infinite loops if you don't take care to avoid them.
46

METHODS

48       $object->root()
49       $object->rootpath()
50           `"root()"' returns the root node if `$object' is a
51           `"Data::Grove::Parent"' object.  `"rootpath()"' returns an array of
52           all the nodes between and including the root node and `$object'.
53
54       $tied = $object->add_magic([ $parent ])
55           `"add_magic()"' returns a "Data::Grove::Parent" object with
56           `$object' as it's `"Raw"' object.  If `$parent' is given, that
57           becomes the tied object's parent object.
58

AUTHOR

60       Ken MacLeod, ken@bitsko.slc.ut.us
61

SEE ALSO

63       perl(1), Data::Grove(3)
64
65
66
67perl v5.16.3                      2003-10-21            Data::Grove::Parent(3)
Impressum