I like HTML::Template, despite the name it does regular text templates as well as HTML.

Recently i've started using Template as well (not sure how to link to that one), its a bit heavier to use and install but comes with tons and tons of options.

These two have fit for me every time so I don't even look for others, might be out there but these are two that have been around the block.

Update:I assumed that your sample was just a sample, if you are actually working with SQL you probably want to use a different solution.

Something like:

my $update = { ADDRESS => 'test', customer_name => 'eric' }; my @cols = sort grep { defined $update->{$_}} keys %$update; my $sql = join (",", map { "$_ = ?" } @cols ); print "UPDATE test SET $sql WHERE id = ?"; #then you can use it like: # $dbh->execute("UPDATE test SET $sql WHERE id = ?",undef, map {%updat +e{$_}} @cols, $id);

___________
Eric Hodges

In reply to Re: Simple Template System That Supports Conditional Content? by eric256
in thread Simple Template System That Supports Conditional Content? by Jim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.