/usr/share/perl5/Data/Grove.pm is in libxml-perl 0.08-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #
# Copyright (C) 1999 Ken MacLeod
# Data::Grove is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# $Id: Grove.pm,v 1.6 1999/12/22 21:15:00 kmacleod Exp $
#
###
### For a similar package, see also:
###
### Graph::Element -- elements for a directed graph
### Neil Bowers <neilb@cre.canon.co.uk> (NIELB)
###
package Data::Grove;
use vars qw{ $VERSION };
# will be substituted by make-rel script
$VERSION = "0.08";
sub new {
my $type = shift;
my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
if (defined $self->{Raw}) {
# clone the raw object
$self = { %{ $self->{Raw} } };
}
return bless $self, $type;
}
package Data::Grove::Characters;
use vars qw{ @ISA $type_name };
@ISA = qw{Data::Grove};
$type_name = 'characters';
1;
__END__
=head1 NAME
Data::Grove -- support for deeply nested structures
=head1 SYNOPSIS
use Data::Grove;
$object = MyPackage->new;
package MyPackage;
@ISA = qw{Data::Grove};
=head1 DESCRIPTION
C<Data::Grove> provides support for deeply nested tree or graph
structures. C<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.
C<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 C<Data::Grove> are
C<Data::Grove::Parent> and C<Data::Grove::Visitor>.
C<Data::Grove::Parent> adds a `C<Parent>' property to grove objects
and implements a `C<root>' method to grove objects to return the root
node of the tree from anywhere in the tree and a `C<rootpath>' method
to return a list of nodes between the root node and ``this'' node.
C<Data::Grove::Visitor> adds callback methods `C<accept>' and
`C<accept_name>' that call your handler or receiver module back by
object type name or the object's name.
C<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.
C<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. `C<$object-E<gt>{Property}>'). Extension modules may
also define properties that they support or use, for example
Data::Grove::Parent adds `C<Parent>' and `C<Raw>' properties and
Visitor depends on `C<Name>' and `C<Content>' properties.
See the module C<XML::Grove> for an example implementation of
C<Data::Grove>.
=head1 METHODS
=over 4
=item 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 C<Data::Grove>
object. If an existing C<Data::Grove> is passed to `C<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.
=back
=head1 AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us
=head1 SEE ALSO
perl(1)
=cut
|