<?xml version="1.0" encoding="windows-1252"?>
<node id="280502" title="3Re: HTML::Tree(Builder) in 6 minutes" created="2003-08-03 16:07:00" updated="2005-07-07 14:55:09">
<type id="11">
note</type>
<author id="18800">
jeffa</author>
<data>
<field name="doctext">
They actually do neither ... they are templating modules and
have no responsibility of producing valid HTML - that's up
to the HTML coder. As for being overkill, well ... the more
you use these tools, the quicker you get at coding with
them. You can see an example that i am proud of over at
[id://280493] that uses HTML::Template. The template is
stored inside DATA - creating a new H::T object that uses
the DATA filehandle is a snap:
&lt;code&gt;
my $template = HTML::Template-&gt;new(filehandle =&gt; \*DATA);
&lt;/code&gt;
For the Template-Toolkit quick and simple scripts, check
out [cpan://Inline::TT], it's slow as hell, but when you
combine it with [cpan://Class::DBI] you get some amazing
results. I am nearly finished with my C::D mini-tut that
will demonstrate using C::D with multiple tables, but here
is a snippet just to show you the power of the Class::DBI
and Template combo. (and by the way, i learned most of this
from [http://www.perl.com/pub/a/2003/07/15/nocode.html|How 
to Avoid Writing Code] and the
[http://sourceforge.net/mailarchive/forum.php?forum_id=4464|poop-group
mailing list])
&lt;readmore&gt;
&lt;code&gt;
use strict;
use warnings;
use DVD::movie;
use Inline 'TT';

print DVD(movies =&gt; [DVD::movie-&gt;retrieve_all]);

__DATA__
__TT__
[% BLOCK DVD %]
   [% FOREACH movie = movies %]
   &lt;img src="http://dvd.unlocalhost.com/images/[% movie.id %].jpg" align="right" /&gt;
   &lt;h2&gt;[% movie.title %]&lt;/h2&gt;
   &lt;ul&gt;
      &lt;li&gt; Year - [% movie.year %]&lt;/li&gt;
      &lt;li&gt;Added - [% movie.timestamp %]&lt;/li&gt;
      &lt;li&gt;Directors:&lt;/li&gt;
      &lt;ul&gt;
      [% FOREACH director = movie.directors %]
         &lt;li&gt;[% director.name %]&lt;/li&gt;
      [% END %]
      &lt;/ul&gt;
      &lt;li&gt;Writers:&lt;/li&gt;
      &lt;ul&gt;
      [% FOREACH writer = movie.writers %]
         &lt;li&gt;[% writer.name %]&lt;/li&gt;
      [% END %]
      &lt;/ul&gt;
      &lt;li&gt;Genres:&lt;/li&gt;
      &lt;ul&gt;
      [% FOREACH genre = movie.genres %]
         &lt;li&gt;[% genre.name %]&lt;/li&gt;
      [% END %]
      &lt;/ul&gt;
   &lt;/ul&gt;
   &lt;br clear="right" /&gt;
   [% END %]
[% END %]
&lt;/code&gt;
That's just too easy. ;)
&lt;/readmore&gt;
&lt;p&gt;jeffa&lt;/p&gt;
&lt;font size=1&gt;
&lt;pre&gt;
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(&lt;a href="http://jeffa.perlmonk.org/tripdid.mp3"&gt;the triplet paradiddle with high-hat&lt;/a&gt;)
&lt;/pre&gt;&lt;/font&gt;</field>
<field name="root_node">
280461</field>
<field name="parent_node">
280499</field>
</data>
</node>
