Yeah, I used to use TT, <a href="http://www.template-toolkit.org/">http://www.template-toolkit.org/</a>, and it worked
quite nice.&nbsp; It made it so much easier so I didn't have any HTML
code mixed in with my Perl.&nbsp; Now I am programming in ASP :/<br>
<br>
Randy<br><br><div><span class="gmail_quote">On 9/9/05, <b class="gmail_sendername">Mike South</b> &lt;<a href="mailto:msouth@gmail.com">msouth@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If you want something that can do everything HTML::Template does, but<br>also anything else you could possibly want, look at Template Toolkit.<br><br>I have used both fairly extensively, and sooner or later you are going<br>
to run into a limitation with HTML::Template that you can't easily get<br>around.&nbsp;&nbsp;Template Toolkit is very powerful and highly extensible and<br>is unlikely to ever run out of power for what you want to do.<br><br>If you're just starting fresh with a new project, I would recommend
<br>going with Template Toolkit from the beginning so that you don't end<br>up having to rewrite all your templates later when your application's<br>need move out beyond what HTML::Template can do.<br><br>Just to give you a couple of examples:
<br><br>In HTML::Template you can do a &lt;tmpl_if foo&gt;, but it only tells you if<br>foo is true or false.&nbsp;&nbsp;What if you want &lt;tmpl_if foo='blah'&gt;?&nbsp;&nbsp;What if<br>you later realize that everything would be much easier if you could do
<br>&lt;tmpl_if foo =~/bla(h|bber)/&gt;?&nbsp;&nbsp;Template Toolkit can do an if with<br>equals or matches (not with the exact syntax I showed there, but it<br>can do it).<br><br>One of the nicest things about Template Toolkit is that you can pass
<br>in structured data and access it from the template.&nbsp;&nbsp;If you have an<br>array of hashes like this:<br><br>$folks = [<br>{<br>name =&gt; 'bob',<br>fruit =&gt;'kiwi',<br>friends =&gt; [qw/ sally jessie raphael/],<br>},<br>
<br>{<br>name =&gt; 'sally',<br>fruit =&gt; 'kumquat',<br>friends =&gt;[],<br>}<br>];<br><br>and you pass that in to a template as 'folks',&nbsp;&nbsp;you can have a loop like this:<br><br>[% FOREACH person = folks %]<br>[% <a href="http://person.name">
person.name</a> %] likes [% person.fruit %]<br>[% FOREACH friend = person.friends %]<br>[% IF loop.first %][% <a href="http://person.name">person.name</a> %] is a friend of: [%END%]<br>[% friend %]<br>[% END %]<br>[% END %]
<br><br>Here's a complete script.&nbsp;&nbsp;It's a little harder to get going with<br>Template Toolkit for the first time, but it's worth it.<br>#!/usr/bin/perl&nbsp;&nbsp;-w<br>use strict;<br>use Template;<br><br>my $folks = [<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name =&gt; 'bob',
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fruit =&gt;'kiwi',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friends =&gt; [qw/ sally jessie raphael/],<br>&nbsp;&nbsp; },<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name =&gt; 'sally',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fruit =&gt; 'kumquat',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friends =&gt;[],<br>&nbsp;&nbsp; },<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name =&gt; 'misery',
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fruit =&gt; 'company',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friends =&gt;[qw/ avarice sloth /],<br>&nbsp;&nbsp; },<br>&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name =&gt; 'batman',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fruit =&gt; 'robin',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friends =&gt;[qw/ catwoman /],<br>&nbsp;&nbsp; },<br>];<br><br>
#and you pass that in to a template as 'folks',&nbsp;&nbsp;you can have a loop like this:<br><br>my $template = Template-&gt;new();<br><br>my $output;<br><br>$template-&gt;process(\*DATA, {folks=&gt;$folks}, \$output) || die $template-&gt;error;
<br><br>print $output;<br><br>__DATA__<br>[%- FOREACH person = folks %]<br>======================<br><br>&nbsp;&nbsp; [%- <a href="http://person.name">person.name</a> %] likes [% person.fruit %]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [%- FOREACH friend = person.friends
 -%]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [%- IF loop.first %]<br>[% <a href="http://person.name">person.name</a> %] is a friend of:[% END -%]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[%- IF loop.last &amp;&amp; person.friends.size &gt; 1&nbsp;&nbsp;%]
and[%<br>END %] [% friend %][% IF not loop.last and person.friends.size &gt; 2<br>%],[% END -%]<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [%- END -%]<br>&nbsp;&nbsp; [%- IF loop.last&nbsp;&nbsp;%]<br>======================<br>&nbsp;&nbsp; [%- END -%]<br><br>[%- END&nbsp;&nbsp;%]<br><br>HTML::Template is evolving, and I have done a lot of useful work with
<br>it, I'm not trying to dis it in the least.&nbsp;&nbsp;I just think it sounds<br>like you are already bumping around the edges of what it can do, and<br>you might be well advised to give Template Toolkit a try.<br><br>mike<br><br>
p.s. I also gzipped the file and attached it to avoid wrapping issues.<br> Here is what the output is supposed to look like:<br><br>[msouth@localhost ~]$ perl apm.pl<br><br>======================<br>bob likes kiwi<br>bob is a friend of: sally, jessie, and raphael
<br>======================<br>sally likes kumquat<br>======================<br>misery likes company<br>misery is a friend of: avarice and sloth<br>======================<br>batman likes robin<br>batman is a friend of: catwoman
<br>======================<br><br><br>On 9/9/05, Bill Raty &lt;<a href="mailto:bill.raty@gmail.com">bill.raty@gmail.com</a>&gt; wrote:<br>&gt; I've found another interesting inflection point is the 'associate' parameter<br>
&gt; given to the template constructor.&nbsp;&nbsp; Associate tells the template that<br>&gt; another object has a 'param' method that acts like the one in CGI.pm: called<br>&gt; with args its a setter, called without args in a list context returns a list
<br>&gt; of parameter names that are provided by the object.&nbsp;&nbsp;Thus the code using the<br>&gt; template can do some passive relection of templates by making a crafty<br>&gt; 'param' method.<br>&gt;<br>&gt;&nbsp;&nbsp;I'll send out examples if I'm able to cobble up anything promising.
<br>&gt;<br>&gt;&nbsp;&nbsp;Meanwhile, thanks again Austin Mongers!<br>&gt;<br>&gt;&nbsp;&nbsp;-Bill<br>&gt;<br>&gt; On 9/8/05, Bill Raty &lt;<a href="mailto:bill.raty@gmail.com">bill.raty@gmail.com</a>&gt; wrote:<br>&gt; &gt; Thanks Wayne.<br>
&gt; &gt;<br>&gt; &gt; Aha!&nbsp;&nbsp;I may get away with it using the 'filters'.&nbsp;&nbsp;Also the special loop<br>&gt; vars look promising:<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &lt;TMPL_LOOP NAME=&quot;FOO&quot;&gt;<br>&gt; &gt; &lt;TMPL_IF NAME=&quot;__first__&quot;&gt;
<br>&gt; &gt; This only outputs on the first pass.<br>&gt; &gt; &lt;/TMPL_IF&gt;<br>&gt; &gt;<br>&gt; &gt; &lt;TMPL_IF NAME=&quot;__odd__&quot;&gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; This outputs every other pass, on the odd passes.
<br>&gt; &gt; &lt;/TMPL_IF&gt;<br>&gt; &gt;<br>&gt; &gt; &lt;TMPL_UNLESS NAME=&quot;__odd__&quot;&gt;<br>&gt; &gt; This outputs every other pass, on the even passes.<br>&gt; &gt; &lt;/TMPL_IF&gt;<br>&gt; &gt;<br>&gt; &gt;
<br>&gt; &gt;<br>&gt; &gt; &lt;TMPL_IF NAME=&quot;__inner__&quot;&gt;<br>&gt; &gt; This outputs on passes that are neither first nor last.<br>&gt; &gt; &lt;/TMPL_IF&gt;<br>&gt; &gt;<br>&gt; &gt; This is pass number &lt;TMPL_VAR NAME=&quot;__counter__&quot;&gt;.
<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &lt;TMPL_IF NAME=&quot;__last__&quot;&gt;<br>&gt; &gt; This only outputs on the last pass.<br>&gt; &gt; &lt;TMPL_IF&gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &lt;/TMPL_LOOP&gt;
<br>&gt; &gt;<br>&gt; &gt; It still seems to require that the template writer to know too much about<br>&gt; inclusions or adhere to a convention.<br>&gt; &gt;<br>&gt; &gt; -Bill<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>
&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; On 9/8/05, Wayne Walker &lt;<a href="mailto:wwalker@bybent.com">wwalker@bybent.com</a> &gt; wrote:<br>&gt; &gt; &gt; You can do this with TMPL_IF and TMPL_INCLUDE
<br>&gt; &gt; &gt; &lt;head&gt;<br>&gt; &gt; &gt;&nbsp;&nbsp; &lt;tmpl_if name=calendar_present&gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tmpl_include name=&quot;path/to/cal.js&quot;&gt;<br>&gt; &gt; &gt;&nbsp;&nbsp; &lt;/tmpl_if&gt;<br>&gt; &gt; &gt; &lt;/head&gt;
<br>&gt; &gt; &gt; &lt;body&gt;<br>&gt; &gt; &gt; stuff<br>&gt; &gt; &gt;&nbsp;&nbsp; &lt;tmpl_if name=calendar_present&gt;<br>&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div .....&gt;<br>&gt; &gt; &gt;&nbsp;&nbsp; &lt;/tmpl_if&gt;<br>&gt; &gt; &gt; &lt;/body&gt;
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; This requires that you set calendar_present=1 in the calling program.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Since I'm not sure what decides if the calendar ends up in the<br>&gt; &gt; &gt; container, I can't guess further
<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; On Thu, Sep 08, 2005 at 04:58:52PM -0500, Bill Raty wrote:<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;I'm trying not to reinvent the wheel, but I'm having difficulty
<br>&gt; determining<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;if the wheel I'm needing has been invented.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;I've looked at HTML::Template POD, and I get the basic concept.&nbsp;&nbsp;In<br>&gt; my<br>
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;ignorance I'm failing to see how I can apply it to my problem, and<br>&gt; ifthere<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;are other CPAN modules that are better suited to my task.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;I want to have a DWIMy page component system so that page controls
<br>&gt; can be<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;called out and &quot;Do The Right Thing&quot;.&nbsp;&nbsp;Example:<br>&gt; &gt; &gt; &gt;<br>&gt;
&gt; &gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;I&nbsp;&nbsp;have&nbsp;&nbsp;a&nbsp;&nbsp;calendar&nbsp;&nbsp;input&nbsp;&nbsp;widget
set that<br>&gt; requires pieces of HTML,<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;JavaScript, and CSS, which need to be exposed in the container<br>&gt; page; a<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;script tag in the &quot;head&quot;,&nbsp;&nbsp;a 'div' that needs to appear early on
<br>&gt; inside the<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&quot;body&quot; tag, and the 'input' tag that has event handlers that usethe<br>&gt; earlier<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;script tag.<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;I'd like a system that abstract the container page, that lets me
<br>&gt; develop the<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;calendar control component as if it were the containing page, but<br>&gt; when<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;added/included/embedded in the container page the system smartly<br>&gt; places the
<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;control component elements in the correct part of the containing<br>&gt; page.&nbsp;&nbsp;The<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;clincher is the second add of the calendar widget doesn't duplicate<br>&gt; the<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;'script' and 'div' tags, but only interjects the 'input' tag for
<br>&gt; the second<br>&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;control.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; &gt; Austin mailing list<br>&gt; &gt; &gt; &gt; <a href="mailto:Austin@pm.org">
Austin@pm.org</a><br>&gt; &gt; &gt; &gt; <a href="http://mail.pm.org/mailman/listinfo/austin">http://mail.pm.org/mailman/listinfo/austin</a><br>&gt; &gt; &gt;<br>&gt; &gt; &gt; --<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Wayne Walker
<br>&gt; &gt; &gt;<br>&gt;
&gt; &gt;
<a href="mailto:wwalker@bybent.com">wwalker@bybent.com</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Do
you use Linux?!<br>&gt; &gt; &gt;
<a href="http://www.bybent.com">http://www.bybent.com</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Get Counted!<br>&gt; <a href="http://counter.li.org/">http://counter.li.org/</a><br>&gt; &gt; &gt; Perl - <a href="http://www.perl.org/">http://www.perl.org/</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Perl User Groups -<br>&gt; <a href="http://www.pm.org/">
http://www.pm.org/</a><br>&gt; &gt; &gt; Jabber:&nbsp;&nbsp;<a href="mailto:wwalker@jabber.gnumber.com">wwalker@jabber.gnumber.com</a>&nbsp;&nbsp; AIM:&nbsp;&nbsp;&nbsp;&nbsp; lwwalkerbybent<br>&gt; &gt; &gt; IRC:&nbsp;&nbsp;&nbsp;&nbsp; wwalker on <a href="http://freenode.net">freenode.net
</a><br>&gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; Austin mailing list<br>&gt; &gt; &gt; <a href="mailto:Austin@pm.org">Austin@pm.org</a><br>&gt; &gt; &gt; <a href="http://mail.pm.org/mailman/listinfo/austin">
http://mail.pm.org/mailman/listinfo/austin</a><br>&gt; &gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; Austin mailing list<br>&gt; <a href="mailto:Austin@pm.org">
Austin@pm.org</a><br>&gt; <a href="http://mail.pm.org/mailman/listinfo/austin">http://mail.pm.org/mailman/listinfo/austin</a><br>&gt;<br>&gt;<br><br><br>_______________________________________________<br>Austin mailing list
<br><a href="mailto:Austin@pm.org">Austin@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/austin">http://mail.pm.org/mailman/listinfo/austin</a><br><br><br></blockquote></div><br>