NAME

Data::Hopen::Scope::Hash - a hash-based nested key-value store

SYNOPSIS

This class implements Data::Hopen::Scope using a single hash table as the storage. It only supports one set of data ("$set" in Data::Hopen::Scope), which is named 0.

ATTRIBUTES

outer

The fallback Scope for looking up names not found in this Scope. If non is provided, it is undef, and no fallback will happen.

name

Not used, but provided so you can use "hnew" in Data::Hopen to make Scopes.

METHODS

put

Add key-value pairs to this scope. See "put" in Data::Hopen::Scope. In this particular implementation, the last-added value for a particular key wins.

TODO add $set option once it's added to D::H::Scope::put().

merge

Merge in values. See "merge" in Data::Hopen::Scope.

adopt_hash

Takes over the given hash to be the new contents of the Scope::Hash. Usage example:

$scope->adopt_hash({ foo => 42 });

The scope uses exactly the hash passed, not a clone of it. If this is not applicable to a subclass, that subclass should override it as ... or an express die.

_names_here

Populates a Set::Scalar with the names of the items stored in this Scope, but not any outer Scope. Called as:

$scope->_names_here($retval[, $set]);

No return value.

_find_here

Looks for a given item in this scope, but not any outer scope. Called as:

$scope->_find_here($name[, $set])

Returns the value, or undef if not found.