Re: [Templates] Design question

[prev] [thread] [next] [Date index for 2004/06/28]

From: Buddy Burden
Subject: Re: [Templates] Design question
Date: 22:33 on 28 Jun 2004
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
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

[Templates] Design question
Buddy Burden 18:58 on 28 Jun 2004

Re: [Templates] Design question
Jeff Anderson 19:16 on 28 Jun 2004

Re: [Templates] Design question
Mark Mills 19:16 on 28 Jun 2004

Re: [Templates] Design question
Buddy Burden 20:20 on 28 Jun 2004

RE: [Templates] Design question
Bruce McKenzie 20:46 on 28 Jun 2004

Re: [Templates] Design question
Ken.Olstad 20:55 on 28 Jun 2004

Re: [Templates] Design question
Perrin Harkins 21:25 on 28 Jun 2004

Re: [Templates] Design question
Jeff Anderson 21:47 on 28 Jun 2004

Re: [Templates] Design question
Buddy Burden 16:11 on 01 Jul 2004

Re: [Templates] Design question
Jeff Anderson 18:05 on 01 Jul 2004

Re: [Templates] Design question
Buddy Burden 22:33 on 28 Jun 2004

Re: [Templates] Design question
Perrin Harkins 22:52 on 28 Jun 2004

Re: [Templates] Design question
Buddy Burden 23:18 on 28 Jun 2004

Re: [Templates] Design question
Perrin Harkins 03:21 on 29 Jun 2004

Re: [Templates] Design question
Buddy Burden 16:22 on 29 Jun 2004

Re: [Templates] Design question
Mark Mills 17:09 on 29 Jun 2004

Re: [Templates] Design question
Buddy Burden 17:47 on 29 Jun 2004

[Templates] Design question
Chris Ochs 06:53 on 08 Dec 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52