>>>>> "David" == David Cantrell <[EMAIL PROTECTED]> writes:

David> Here's how you'd display a perl hash as an HTML table ...

David> <table>
David>   <tr>
David>     <th>key</th>
David>     <th>value</th>
David>   </tr>
David>   <perl>
David>     foreach my $key (%hash) {
David>   </perl>
David>   <tr>
David>     <td><em><perl>print $key</perl>:</em></td>
David>     <td><perl>print $hash{$key}</perl></td>
David>   </tr>
David>   <perl>
David>     }
David>   </perl>
David> </table>

In TT, that'd be

    <table>
      <tr>
        <th>key</th>
        <th>value</th>
      </tr>
      [%
        FOR key IN hash.keys
      %]
      <tr>
        <td><em>[% key %]:</em></td>
        <td>[% hash.key %]</td>
      </tr>
      [%
        END
      %]
    </table>

I find that much easier to read.  And I can even explain it (mostly :-)
to someone who doesn't know Perl.

You seem to be reinventing Mason, with a slightly different syntax
(<perl> .. </perl>, instead of <% .. %>).  And that's why I hate Mason
now.  There's no "mini-language" that I can teach a non-Perl-head to
help me with my pages.  They must be exposed to ALL OF PERL for
anything non-trivial.  Ugh.

David> Yes, you're right, I never got round to interpolating variables directly
David> into the HTML, but that would be REALLY trivial to add in, and I'll do it
David> if the lack of it annoys me enough.  This is no different from the way
David> it would be done in any other templating system, the one difference being
David> that I was too lazy to invent my own little language and decided to use
David> perl instead.

But it's *soooo* close to Mason.  Use that.  Stop trying harder. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to