Data::Hive::Store::Hash - store a hive in a flat hashref


Data-Hive documentation  | view source Contained in the Data-Hive distribution.

Index


NAME

Top

Data::Hive::Store::Hash - store a hive in a flat hashref

VERSION

Top

version 1.008

DESCRIPTION

Top

This is a simple store, primarily for testing, that will store hives in a flat hashref. Paths are packed into strings and used as keys. The structure does not recurse -- for that, see Data::Hive::Store::Hash::Nested.

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 something like:

  {
    foo => 1,
    'foo.bar.baz' => 2
  }

METHODS

Top

new

  my $store = Data::Hive::Store::Hash->new(\%hash, \%arg);

The only argument expected for new is a hashref, which is the hashref in which hive entries are stored.

If no hashref is provided, a new, empty hashref will be used.

The extra arguments may include:

path_packer

A Data::Hive::PathPacker-like object used to convert between paths (arrayrefs) and hash keys.

hash_store

This method returns the hashref in which things are being used. You should not alter its contents!

AUTHORS

Top

COPYRIGHT AND LICENSE

Top


Data-Hive documentation  | view source Contained in the Data-Hive distribution.