This is another small module that I wrote while working on News::Gateway. I needed a way to combine data from a read-only tied DBM file with additional key/value pairs that were determined at run-time in a fashion that didn't require lots of special-casing all over the code. Hence this module.

Tie::ShadowHash overlays a series of hashes, which can be normal hashes, tied hashes, or even hashes made up from arrays, text files, or run-time assignments, so that any lookups in the resulting tied hash go through each data source in order. This allows values to be changed at run-time without changing the underlying read-only data source, or to easily combine multiple sources of data.

The module is very simple and works. It had been very stable since 2002, although in 2010 I made a new release fixing some problems with hash iteration and correct handling of storing undef values.


The only requirement for the module itself is Perl 5.006 or later.

To run the test suite, Test::More (included with Perl 5.6.2 and later or available on CPAN) is required. Test::Pod, Pod::Spell, and either aspell or ispell are required to run the spelling tests. They can be found in CPAN (and are packaged for Debian). Spelling tests are disabled unless an environment variable is set since spelling dictionaries vary too much by system.


The module:

Tie::ShadowHash 1.00 2010-04-03 Download PGP signature

An archive of older releases is also available.


Tie::ShadowHash is maintained using the Git version control system. To check out the current development tree, clone:


You can also browse the current development source.


Copyright 1999, 2002, 2010 by Russ Allbery <rra@stanford.edu>

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. This means that you may choose between the two licenses that Perl is released under: the GNU GPL and the Artistic License. Please see your Perl distribution for the details and copies of the licenses.

Last spun 2021-09-25 from thread modified 2013-01-04