Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

data::grove(3) [suse man page]

Data::Grove(3)						User Contributed Perl Documentation					    Data::Grove(3)

NAME
Data::Grove -- support for deeply nested structures SYNOPSIS
use Data::Grove; $object = MyPackage->new; package MyPackage; @ISA = qw{Data::Grove}; DESCRIPTION
"Data::Grove" provides support for deeply nested tree or graph structures. "Data::Grove" is intended primarily for Perl module authors writing modules with many types or classes of objects that need to be manipulated and extended in a consistent and flexible way. "Data::Grove" is best used by creating a core set of ``data'' classes and then incrementally adding functionality to the core data classes by using ``extension'' modules. One reason for this design is so that the data classes can be swapped out and the extension modules can work with new data sources. For example, these other data sources could be disk-based, network-based or built on top of a relational database. Two extension modules that come with "Data::Grove" are "Data::Grove::Parent" and "Data::Grove::Visitor". "Data::Grove::Parent" adds a `"Parent"' property to grove objects and implements a `"root"' method to grove objects to return the root node of the tree from anywhere in the tree and a `"rootpath"' method to return a list of nodes between the root node and ``this'' node. "Data::Grove::Visitor" adds callback methods `"accept"' and `"accept_name"' that call your handler or receiver module back by object type name or the object's name. "Data::Grove" objects do not contain parent references, Perl garbage collection will delete them when no longer referenced and sub- structures can be shared among several structures. "Data::Grove::Parent" is used to create temporary objects with parent pointers. Properties of data classes are accessed directly using Perl's hash functions (i.e. `"$object->{Property}"'). Extension modules may also define properties that they support or use, for example Data::Grove::Parent adds `"Parent"' and `"Raw"' properties and Visitor depends on `"Name"' and `"Content"' properties. See the module "XML::Grove" for an example implementation of "Data::Grove". METHODS
new( PROPERTIES ) Return a new object blessed into the SubClass, with the given properties. PROPERTIES may either be a list of key/value pairs, a single hash containing key/value pairs, or an existing "Data::Grove" object. If an existing "Data::Grove" is passed to `"new()"', a shallow copy of that object will be returned. A shallow copy means that you are returned a new object, but all of the objects underneath still refer to the original objects. AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us SEE ALSO
perl(1) perl v5.12.1 2003-10-21 Data::Grove(3)

Check Out this Related Man Page

Data::Grove::Parent(3)					User Contributed Perl Documentation				    Data::Grove::Parent(3)

NAME
Data::Grove::Parent - provide parent properties to Data::Grove objects SYNOPSIS
use Data::Grove::Parent; $root = $object->root; $rootpath = $object->rootpath; $tied = $object->add_magic([ $parent ]); $node = Data::Grove::Parent->new($hash [, $parent]); $node_list = Data::Grove::ParentList->new($array [, $parent]); DESCRIPTION
Data::Grove::Parent is an extension to Data::Grove that adds `"Parent"' and `"Raw"' properties to Data::Grove objects and methods for returning the root node of a grove, a list of nodes between and including the root node and the current node, and a method that creates parented nodes. Data::Grove::Parent works by creating a Perl ``tied'' object that contains a parent reference (`"Parent"') and a reference to the original Data::Grove object (`"Raw"'). Tying-magic is used so that every time you reference the Data::Grove::Parent object it actually references the underlying raw object. When you retrieve a list or a property of the Raw object, Data::Grove::Parent automatically adds magic to the returned list or node. This means you only call `add_magic()' once to create the first Data::Grove::Parent object and then use the grove objects like you normally would. The most obvious use of this is so you don't have to call a `"delete"' method when you want to release a grove or part of a grove; since Data::Grove and Data::Grove::Parent objects have no cyclic references, Perl can garbage collect them normally. A secondary use is to allow you to reuse grove or property set fragments in multiple trees. WARNING: Data::Grove currently does not protect you from creating your own cyclic references! This could lead to infinite loops if you don't take care to avoid them. METHODS
$object->root() $object->rootpath() `"root()"' returns the root node if `$object' is a `"Data::Grove::Parent"' object. `"rootpath()"' returns an array of all the nodes between and including the root node and `$object'. $tied = $object->add_magic([ $parent ]) `"add_magic()"' returns a "Data::Grove::Parent" object with `$object' as it's `"Raw"' object. If `$parent' is given, that becomes the tied object's parent object. AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us SEE ALSO
perl(1), Data::Grove(3) perl v5.12.1 2003-10-21 Data::Grove::Parent(3)
Man Page