|Perl Monk, Perl Meditation|
ChainMap of Hashes on CPAN?by LanX (Chancellor)
|on Mar 23, 2013 at 16:18 UTC||Need Help??|
LanX has asked for the
wisdom of the Perl Monks concerning the following question:
I stumbled about a talk video from a Python Guru propagating a ChainMap feature
In Perl-lingo it's essentially a hash-tie where FETCH dynamically tries to find a key in a list of contained hashes.
Instead of concatenating these long lists statically (i.e. %H=(%h1,%h2,%h3)) this dynamic approach is faster when dealing with big hashes.
(It also implies that changes to underlying hashes are reflected afterwards)
Before I reinvent the wheel ...
... is there already a module on CPAN doing this? Couldn't find one!
( addicted to the Perl Programming Language)
PS: Yes it has big similarities to the mechanism of @INC for STASHES and the JS prototype lookup chain.