Guys,

> The Perl module Data::Table on CPAN interfaces nicely with databases
> and with TT2. The tables Data::Table returns in response to DB queries
> can be accessed and manipulated as arrays of rows, arrays of hashrefs,
> just plain arrays, etc.

Well, I wasn't really looking for replacements for my object, but that does sound intriguing. I'll definitely take a look ... if nothing else perhaps I can get some implementation ideas. :-)

> If your DataRow object resembles a hash and you want to access it
> like a hash, then that's exactly what tie() is for, right?

True. But, LIS, that loses the functionality of being able to treat it as an array as well. And I would prefer something that goes on behind the scenes, rather than something I (and other programmers) have to remember to do every time we use it.

Actually, a tied hash is not an object.  Maybe you're passing something
else?

I'm passing my DataRow object, which is indeed an object. It's _implemented_ via a tied hash internally, but that's all under-the-covers stuff.


I'm not sure about the XS Stash, but the Perl Stash should do the right
thing on tied hashes and arrays, because they return "HASH" or "ARRAY"
in response to ref(), unlike objects.  For demonstration:

Right, that's the key, from my perusal of Template::Stash. I've either got to make ref() return 'HASH', or possibly get UNIVERSAL::isa() to return 'HASH' as a fallback (but I don't know if that would make it work for virtual methods). And I'm pretty sure I can't make my object do either of those things without fiddling with things that I really oughtn't. <g>


I was wondering if maybe there was a whole 'nother approach that I was ignoring, like maybe somebody would say "oh sure, just write a new plugin" or somesuch. But it's looking like that was an overly optimistic thought. :)


-- Buddy

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

Reply via email to