Data-StackedHash

 view release on metacpan or  search on metacpan

lib/Data/StackedHash.pm  view on Meta::CPAN

  tied(%h)->push; # put a new hash on the stack
  $h{'a'}=3;      # override value of key 'a'
    ...
  tied(%h)->pop;  # remove top hash from the stack,
                  # $h{'a'} == 1 again


=head1 DESCRIPTION

The Data::StackedHash module implements a stack of hashes; the whole
stack acts collectively and transparently as a single PERL hash, that
is, you can perform the usual operations (fetching/storing values,
I<keys>, I<delete>, etc.)  on it.  All the PERL buitlins which operate
on hashes are supported.

Assigning a value to a key, as in C<< $h{'a'}=1 >>, puts the key/value
pair into the hash at the top of the stack. Reading a key off the
stack of hashes searches the whole stack, from the topmost hash to the
bottom one, until it finds a hash which holds some value associated to
the given key; returns C<< undef >> if no match was found.



( run in 0.372 second using v1.01-cache-2.11-cpan-0a6323c29d9 )