Perrin,

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.

Well, yes, overloading is exactly what it is. I never meant to imply otherwise. I don't believe there is any way to use tying to make one variable behave like both an array and a hash.


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

Yes, I've seen that ... we only recently upgraded to 5.8, so I haven't gotten too deep into that yet. I plan to investigate it to see if I can use that in my implementation instead, but I may not be able to, because while I don't want to allow changes to they keys _casually_ (i.e., via autovivification), I do have to have be able to do it when called for.


But I fear we may have drifted from the original topic, and I don't want to get too far off, given that this is a mailing list for TT2. Basically, the situation is that I have an object, which has three years worth of code built around it. It works, and it works well. I don't want to replace it, and, while I may want to change the internal implementation at some point, that doesn't really enter into the discussion at hand. I can, however, rather trivially extend it to add new functionality that doesn't impact existing code.

Given all that, is the best way to make this work with TT2 to extend it until it reaches full emulation of a hash inside TT2? or is there a better, simpler way? That's the real question I'm trying to get at.


-- Buddy

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

Reply via email to