Build::Hopen::Scope::Hash - a hash-based nested key-value store
This class implements Build::Hopen::Scope using a single hash table as the storage. It only supports one set of data ("$set" in Build::Hopen::Scope), which is named 0.
0
The fallback Scope for looking up names not found in this Scope. If non is provided, it is undef, and no fallback will happen.
Scope
undef
Not used, but provided so you can use "hnew" in Build::Hopen to make Scopes.
See also "add", below, which is part of the public API.
Several of the functions receive a $levels parameter. Its meaning is:
$levels
If $levels is provided and nonzero, go up that many more levels (i.e., $levels==0 means only return this scope's local names).
$levels==0
If $levels is not provided or not defined, go all the way to the outermost Scope.
To implement a Scope with a different data-storage model than the hash this class uses, subclass Scope and override these functions. Only "add" is part of the public API.
Add key-value pairs to this scope. Returns the scope so you can chain. Example usage:
my $scope = Build::Hopen::Scope::Hash->new()->add(foo => 1);
add is responsible for handling any conflicts that may occur. In this particular implementation, the last-added value for a particular key wins.
add
TODO add $set option
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.
...
die
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.
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.
To install Build::Hopen, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Build::Hopen
CPAN shell
perl -MCPAN -e shell install Build::Hopen
For more information on module installation, please visit the detailed CPAN module installation guide.