in reply to Tie with dispatch table
Well, Tie::Hash is a base class for tied hashes so your foundation is already in place. You just need to overide a few methods such as STORE (to make it read only) and FETCH (to check exists on the internal dispatch table and invoke or fall back to your default method).
I will leave the implementation up to you, but please come back if you need help with specifics. If you need an example of a tied hash that uses multiple underlying datastructures (with support for initializing options in the constructor), take a look at Tie::Hash::Sorted. I used a hash and an array under the covers.Cheers - L~R
|
|---|