Data::Hive::Store::Hash::Nested - store a hive in nested hashrefs
version 1.011
This is a simple store, primarily for testing, that will store hives in nested hashrefs. All hives are represented as hashrefs, and their values are stored in the entry for the empty string.
So, we could do this:
my $href = {}; my $hive = Data::Hive->NEW({ store_class => 'Hash', store_args => [ $href ], }); $hive->foo->SET(1); $hive->foo->bar->baz->SET(2);
We would end up with $href containing:
$href
{ foo => { '' => 1, bar => { baz => { '' => 2, }, }, }, }
Using empty keys results in a bigger, uglier dump, but allows a given hive to contain both a value and subhives. Please note that this is different behavior compared with earlier releases, in which empty keys were not used and it was not legal to have a value and a hive at a given path. It is possible, although fairly unlikely, that this format will change again. The Hash store should generally be used for testing things that use a hive, as opposed for building hashes that will be used for anything else.
my $store = Data::Hive::Store::Hash->new(\%hash);
The only argument expected for new is a hashref, which is the hashref in which hive entries are stored.
new
If no hashref is provided, a new, empty hashref will be used.
This method returns the hashref in which things are being used. You should not alter its contents!
The name returned by the Hash store is a string, potentially suitable for eval-ing, describing a hash dereference of a variable called $STORE.
$STORE
"$STORE->{foo}->{bar}"
This is probably not very useful. It might be replaced with something else in the future.
Hans Dieter Pearcey <hdp@cpan.org>
Ricardo Signes <rjbs@cpan.org>
This software is copyright (c) 2006 by Hans Dieter Pearcey.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::Hive, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Hive
CPAN shell
perl -MCPAN -e shell install Data::Hive
For more information on module installation, please visit the detailed CPAN module installation guide.