NAME
Build::Hopen::Scope - a hierarchical name table
SYNOPSIS
A Scope represents a set of data available to operations. It is a key-value store that falls back to an outer Scope if a requested key isn't found.
This particular Scope is a concrete implementation using a hash under the hood. However, the public API is limited to "outer", "add", and "find" (plus new from Class::Tiny). Subclasses may use different representations.
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 Build::Hopen to make Scopes.
METHODS
find
Find a named data item in the environment and return it. Returns undef on failure. Usage: $instance-find($name)>. Dies if given a falsy name, notably, '0'.
add
Add key-value pairs to this instance. Returns the instance so you can chain. Example usage:
my $scope = Build::Hopen::Scope->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.
names
Returns a list of the items available through this Scope, including all its parent Scopes (if any).
execute
Run a Build::Hopen::G::Runnable given a set of inputs. Fills in the inputs from the environment if possible. Usage:
$env->execute($runnable[, {inputs...})