Buddy Burden wrote:
I want something that acts like both a hash and an array. The easiest way (AFAIK, anyway) is to make an object with overloaded hash and array dereferencing.

I actually have never heard of anyone doing that before. A more common approach is to simply implement the tied hash interface, like Tie::IxHash does. What you're doing sounds like overloading, not tie-ing.


The overloaded array deref just returns the array that the data's stored in. But the overloaded hash deref can't do that, because the data's not stored in a hash (and can't be unless I want to keep two copies of the data)

That's what most of the other modules do. Seems like a reasonable solution in most cases, but can be a problem with huge amounts of data.


it's more about having something that _mostly_ acts like a hash, but also has some limitations (such as the original pseudohashes, or replacements for them such as Tie::Hash::FixedKeys).

FYI, the official way to do this now is with Hash::Util, which is part of the core library.


- Perrin

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to