Re: [Templates] Accessing hash elements in a tied hash-object

[prev] [thread] [next] [Date index for 2005/04/12]

From: Buddy Burden
Subject: Re: [Templates] Accessing hash elements in a tied hash-object
Date: 16:30 on 12 Apr 2005
Trond,

> Is it possible to access hash elements of an object which is also a
> tied hash?

I'm not entirely sure, but I _think_ you may be in the same boat as me 
(although in my case it's an object with an overloaded hash deref). 
Personally, I had to kludge it, at least temporarily (the way I did that, BTW, 
was to create an AUTOLOAD routine so that every hash reference was also a 
valid method call; clumsy, but effective).

ANAICT, there isn't a "right" way to do it.  However, I think the TT2 code 
could be patched to handle this very easily, and I always meant to submit 
something; I just never got the time to do it.  It's also fairly trivial to 
write tests for, which is a bonus.  I do think that whoever writes this patch 
would need to take a bit of time to profile a couple of different methods to 
make sure there were minimal performance impacts though.  If you were 
interested in trying the patch yourself, I could probably point you at the 
right place in the TT2 code and maybe even help out with some of the test code.

Elsewise, you're probably best off to stick with the ugly method for now and 
wait until I find some spare time.  (Of course, if I'm wrong in diagnosing 
your problem, you should just ignore me entirely; hopefully someone else will 
pipe up and slap me down. <g>)


		-- Buddy

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Accessing hash elements in a tied hash-object
Buddy Burden 16:30 on 12 Apr 2005

Generated at 09:31 on 27 Apr 2005 by mariachi v0.52