Package Info

perl-Data-Hierarchy


Handle data in a hierarchical structure


Development/Libraries/Perl

the Data::Hierarchy manpage provides a simple interface for manipulating inheritable data attached to a hierarchical environment (like a filesystem).

One use of the Data::Hierarchy manpage is to allow an application to annotate paths in a real filesystem in a single compact data structure. However, the hierarchy does not actually need to correspond to an actual filesystem.

Paths in a hierarchy are referred to in a Unix-like syntax; '"/"' is the root "directory". (You can specify a different separator character than the slash when you construct a Data::Hierarchy object.) With the exception of the root path, paths should never contain trailing slashes. You can associate properties, which are arbitrary name/value pairs, with any path. (Properties cannot contain the undefined value.) By default, properties are inherited by child paths: thus, if you store some data at '/some/path':

$tree->store('/some/path', {color => 'red'});

you can fetch it again at a '/some/path/below/that':

print $tree->get('/some/path/below/that')->{'color'};


On the other hand, properties whose names begin with dots are uninherited, or "sticky":

$tree->store('/some/path', {'.color' => 'blue'});
print $tree->get('/some/path')->{'.color'};            # prints blue
print $tree->get('/some/path/below/that')->{'.color'}; # undefined

Note that you do not need to (and in fact, cannot) explicitly add "files" or "directories" to the hierarchy; you simply add and delete properties to paths.


License: Artistic-1.0 or GPL-1.0+
URL: http://search.cpan.org/dist/Data-Hierarchy/

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
0.34-bp155.2.9 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy
0.34-bp154.1.17 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy
0.34-bp153.1.14 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy
0.34-bp152.3.13 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy
0.34-bp151.3.1 info GA Release 2019-07-17 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy
0.34-bp151.2.13 info GA Release 2019-05-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy
0.34-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Hierarchy