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.

HTH

Bruce


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Buddy Burden
Sent: Monday, June 28, 2004 4:21 PM
To: [EMAIL PROTECTED]
Subject: Re: [Templates] Design question

Guys,

> You might look at the stuff already on CPAN like Tie::Hash::Array that 
> have already done the work of blending Hash and Array for you... 
> ...  If nothing else, they might help you 
> fill in the rough edges of your virtual functions and overloaded 
> operators and such.

Thanx, but I think my DataRow is already pretty well set.  It works very 
well (and has been for several years now).  It's just when I introduced 
it to TT2 that I encountered some issues.

Besides, any existing CPAN module that implements a solution as an 
object is going to have the exact same problem that I have with DataRow's.

 >  The first thing that comes to my mind is tie (perldoc perltie).

Well, not sure how you mean that ... internally, the object is indeed 
implemented with a tied hash.  Did you mean to suggest that I tie 
another hash to the DataRow itself?  I suppose that would be possible, 
and should work (as long as ref() thinks it's a hash, that's all that 
really matter, I suppose), but it seems a bit clumsy ... double-tying, 
first of all, and secondly it means that all my code has to remember to 
tie all DataRow's back to regular hashes before passing them off to TT2 
... once I go that far, I'd be better off just converting them back to 
"normal" hashes.  Plus I lose the ability to access them as arrays 
(although I fancy I can't really do that via TT2 right now anyway).


                -- Buddy

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



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

Reply via email to