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

NAME

6       Data::Grove -- support for deeply nested structures
7

SYNOPSIS

9        use Data::Grove;
10
11        $object = MyPackage->new;
12
13        package MyPackage;
14        @ISA = qw{Data::Grove};
15

DESCRIPTION

17       "Data::Grove" provides support for deeply nested tree or graph
18       structures.  "Data::Grove" is intended primarily for Perl module
19       authors writing modules with many types or classes of objects that need
20       to be manipulated and extended in a consistent and flexible way.
21
22       "Data::Grove" is best used by creating a core set of ``data'' classes
23       and then incrementally adding functionality to the core data classes by
24       using ``extension'' modules.  One reason for this design is so that the
25       data classes can be swapped out and the extension modules can work with
26       new data sources.  For example, these other data sources could be disk-
27       based, network-based or built on top of a relational database.
28
29       Two extension modules that come with "Data::Grove" are
30       "Data::Grove::Parent" and "Data::Grove::Visitor".
31       "Data::Grove::Parent" adds a `"Parent"' property to grove objects and
32       implements a `"root"' method to grove objects to return the root node
33       of the tree from anywhere in the tree and a `"rootpath"' method to
34       return a list of nodes between the root node and ``this'' node.
35       "Data::Grove::Visitor" adds callback methods `"accept"' and
36       `"accept_name"' that call your handler or receiver module back by
37       object type name or the object's name.
38
39       "Data::Grove" objects do not contain parent references, Perl garbage
40       collection will delete them when no longer referenced and sub-
41       structures can be shared among several structures.
42       "Data::Grove::Parent" is used to create temporary objects with parent
43       pointers.
44
45       Properties of data classes are accessed directly using Perl's hash
46       functions (i.e. `"$object->{Property}"').  Extension modules may also
47       define properties that they support or use, for example
48       Data::Grove::Parent adds `"Parent"' and `"Raw"' properties and Visitor
49       depends on `"Name"' and `"Content"' properties.
50
51       See the module "XML::Grove" for an example implementation of
52       "Data::Grove".
53

METHODS

55       new( PROPERTIES )
56           Return a new object blessed into the SubClass, with the given
57           properties.  PROPERTIES may either be a list of key/value pairs, a
58           single hash containing key/value pairs, or an existing
59           "Data::Grove" object.  If an existing "Data::Grove" is passed to
60           `"new()"', a shallow copy of that object will be returned.  A
61           shallow copy means that you are returned a new object, but all of
62           the objects underneath still refer to the original objects.
63

AUTHOR

65       Ken MacLeod, ken@bitsko.slc.ut.us
66

SEE ALSO

68       perl(1)
69
70
71
72perl v5.28.1                      2003-10-21                    Data::Grove(3)
Impressum