Very good point. At a previous job I used perl to generate m4 (a `traditional Unix macro processor'), arguably a form of templating. The m4 was part of the Solaris package installation process for the product and was executed on the machine upon which the software was being installed (otherwise I probably would have just sent perl, this being in the days before perl shipped stock with Solaris :).

Recently I've taken to using Template Toolkit in place of m4 for generating config files based on dynamic data (network monitoring using Nagios for 70+ (and growing quickly) remote boxen and routers). There's nothing remotely HTML related about it, it's just much simpler for me to say `type this to add a new host':

[% host( name="foo", addr="10.1.1.99" ) %]

than it would be to make everyone learn how to (reliably, without typos) produce:

define host{ host_name foo alias foo address 10.1.1.99 check_command check-host-alive max_check_attempts 3 process_perf_data 0 retain_nonstatus_information 0 notifications_enabled 0 notification_interval 120 notification_period 24x7 notification_options d,u,r,n }

(Yes, I'm aware Nagios has a form of templating internally, but that can't be driven externally with perl logic. This way I can make the macros smarter (e.g. you may see a definition for host bar, but it won't be live yet so there's no point in monitoring it so don't output anything).)


In reply to Re: Re: Why use templates? by Fletch
in thread Why use templates? by BUU

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.