> You know, you're trying to do too much non-view code in TT.  
> You should do it in Perl, and then hand the result to TT to view.

<sigh> I'm starting to agree with you, but if I agree with you _too_ much, I
have to give up on my original idea of concocting an uber-template that can
be pointed at a "service" to expose all the variables available :) (and I
hadn't even considered coderefs, as Tom I. mentioned).

My problem (stated another way) is that I want to set something up in
mod_perl where a URL like this:
http://host/perl/service/template.html
gets mapped to a perl program called "service.pl" that in turn does a
$tt->process('template.html',\%vars). This would allow developers to simply
create data structures and designers to simply use Template Toolkit
constructs to retrieve them. That's not a problem. The problem is that the
designers need to know *what* they can put in their templates, and I cannot
rely on the developers to document the interface in a consistent and
understandable way. This is what I am trying to achieve by creating a
special template like VARIABLES.html that provides introspection into the
service's data structure.

Now I can think of three options:
(1) Insert a dispatcher here:
http://host/perl/dispatcher/service/VARIABLES.html that checks for a
"special" template and intercepts/alters the output of the service
accordingly so that they can fill it with a data structure easier for TT to
output (yuck)
(2) Create a Service base class that needs to be subclassed, that takes care
of the alternate output required for the "special" template. Doable, but
adds some complexity for the developers (which are of varying skill levels)
(3) Break down and turn on EVAL_PERL and just use Perl in my special
template, walk the data structure, and be done with it.

I think I'm going to look into (3) a bit more, unless I get talked out of it
:) with (2) as plan B.


-- 
Mark Thomas                    [EMAIL PROTECTED]
Internet Systems Architect     User Technology Associates, Inc.

$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;;
 


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

Reply via email to