Slightly simplified scenario: I have a perl script, a database, and set
of templates for a site. Over time, the number of templates will change.
Some will be dropped. Some will be added.
I could modify the script as needed each time I add or drop a template.
But that feels cumbersome. What I'd like to do is carry things a bit
further and modify the script once so it will allow me to add or drop
templates from the set without having to tinker with the script each
time. The issue, of course, is that the data requirements of each
template are unique.
My best thought on this so far is to establish a model for clues to the
data requirements for each template (the script would read the clues to
determine what data to load for each template). These clues could be
stored along with the template (either in a TT comment at the head of
the template or in a companion file with a different extension on the
filename). 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.
I certainly cannot be the first one to think of doing this. Is there
prior art of this sort or have I started on an unpromising course whose
hazards simply have not yet become evident? Any advice on potential
pitfalls or helpful patterns?
Or am I missing some obvious solution?
TIA
David
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates