[Templates] Flexible set of templates

Perrin Harkins perrin@elem.com
Sat, 09 Dec 2006 00:58:36 -0500


David Vergin wrote:
> That way, part of the development of a new template would be 
> to document its data needs in a leading comment in the template itself 
> or in the companion file. Then the rest would take care of itself.

That last part is kind of key...

I'm not sure exactly what problem you're trying to solve, but various 
tries have been made at a system where the templates control what data 
gets pulled.

The simplest way is to use DBI directly from your templates.  The 
arguments for and against are pretty well worn, and I expect you know 
what they are and chose not to do this.

A more complicated way is to have some sort of data access layer in perl 
which your templates talk to.  This would mean something like 
Class::DBI, Rose::DB::Object, DBIx::Class, Tangram, etc.  You load the 
data class you need from your template and call methods on it to get 
data.  If you auto-generate these classes from your database, you 
theoretically can have nothing but a database, some templates, and a 
generic driver script.  It's ultimately the same effect as your template 
metadata idea.

Is this where you wanted to go with it?

- Perrin