Authors,
I have a need for a new Tie module which I will satisfy today. I am surprised
that I can find no suitable implementation on CPAN; perhaps if I've missed a
contender, someone would be kind enough to point it out...
For the API of another module, I am required to pass in a hash of file
information of the form
local_filename => { URI => file_uri, MD5 => md5sum }
The information is coming in to me in another form, from several hashes, which
must be translated. This is fine; a little C<for> loop suffices. However,
the number of entries can get quite large --- up to 1 million; for which the
translation can take up an appreciable portion of an otherwise short-lived
program. Only a few of the entries are used in any one run. Performance is
proving an issue.
So, the solution which presents itself is a 'ProxyHash'. It takes a number of
hash references, and for each lookup requested, checks each reference in turn
until finding a match, at which point it returns the corresponding value. In
addition, each reference has an associated translator function to convert the
value prior to return.
This seems like such a simple application that I'm surprised I can't find one
on CPAN. If there is one, please point it out to me. If not, I propose to
create it today, and upload it as 'Tie::ProxyHash'. Comments?
Mx.