Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: HTML::Template - what's the rule of thumb?

by Willard B. Trophy (Hermit)
on Dec 19, 2003 at 13:52 UTC ( [id://315790]=note: print w/replies, xml ) Need Help??


in reply to Re: HTML::Template - what's the rule of thumb?
in thread HTML::Template - what's the rule of thumb?

It sounds like you're in a very specific situation, CountZero, and the fine old maxim "Whatever Works For You" applies. But I've never met a designer who could handle XSLT. Precious few programmers grok it, either.

I was initially sceptical of templating systems, but HTML::Template lets me build working templates, which I then pass on to more webly types for prettifying. Template usage needn't be incompatible with web standards, either.

HTML::Template is a fine, general-purpose text templating system. With a suitable text file and MIME::Lite, it also makes a good e-mail templating system.

--
bowling trophy thieves, die!

  • Comment on Re: Re: HTML::Template - what's the rule of thumb?

Replies are listed 'Best First'.
Re: Re: Re: HTML::Template - what's the rule of thumb?
by CountZero (Bishop) on Dec 20, 2003 at 09:18 UTC
    I entirely agree with what you are saying: whatever works for one, need not work for someone else.

    Templating systems don't work for me, but that should not let others be stopped from using them.

    Still I think in the long run, templating systems are a dead branch of the evolutionary tree: they are neither pure programs, nor pure mark-up but a hybrid of the two, which IMHO combine the bad things of both for little benefit.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Still I think in the long run, templating systems are a dead branch of the evolutionary tree: they are neither pure programs, nor pure mark-up but a hybrid of the two, which IMHO combine the bad things of both for little benefit.
      I'll disagree, on two levels.

      One, in order to get a file that is "pure markup", you have to have some logic to generate that file. Parts of that logic will have static text, and parts must have enough dynamic logic (decision/iteration/subroutines) to be turing complete. That's actually a perfect place for a templating system!

      Two, if you follow the MVC paradigm, your View usually ends up having to adapt to display the Model being tossed at it by the Controller. A good templating system has at least enough stuff to do that, although it doesn't need (or want) to have enough stuff to be the Controller itself. I think the failure of some templating systems is their attempt to be used as Model or Controller code.

      An example of a failure of "pure markup" is XSLT. You end up twisting yourself around corners just to write programs in what tries to be a pure mark-up language. Feh.

      If you think templating systems are a dead-end, you should probably describe what you would replace them with. It's also possible that you have a narrow application domain that you're specifically addressing. It'd be nice for us to know your scope of statement.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        I run an intranet site which gets data on marine claims out of a database. The various perl scripts generate XML output which are then transformed by XSLT into pure HTML (and CSS provides for the standard look as per our corporation's "look and feel" guidelines).I run one large XSLT file for all the webpages and if something global needs to be changed I do it in one place and everything follows.

        Recently a customer requested that certain columns on the webpages needed to be summed. This only was a small change in the XSLT and nothing had to be changed in the scripts. Now you probably are going to say that you could just as easily have amended the template (but probably many different templates needed to be adapted) and you are probably right. But XSLT has a lot more possibilities than any templating system. In that, it is less (or even not at all) a mark-up language (certainly not a pure mark-up language) than a programming language in its own right.

        Yes it means you have to learn an extra language, but I happen to like it and it provides nice buzzwords to pacify the PHB!

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Still I think in the long run, templating systems are a dead branch of the evolutionary tree:
      and, some would say, so are we homosapiens... I mean, in the long run we will all be extinct. Let's do it better while we are still alive. ;-).

      What I am more intrigued by is...

      they are neither pure programs, nor pure mark-up but a hybrid of the two, which IMHO combine the bad things of both for little benefit.
      what, in your view, are the "bad things" of programs and mark-up that templating systems combine? I am very curious.

      Hybrids are, evolutionarily speaking, almost always stronger than "pure genes" types, and should survive longer than either. Usually hybrids (and, IMHO, definitely H::T) combine the best of two or more types.

      Programming is great for utilizing logic to generate content. Mark-up is great for purposing the content for display. Because of the nature of the content, at times a tiny amount of logic creeps into mark-up, but that is ok, because mark-up is greatly enhanced by that logic.

      I would say that templating systems are as good a hybrid as Aspirin is. It is not pure Acetyl Salicylate -- in its pure form it would be too sour and probably digest our stomach lining -- and it is not pure starch -- that would be too yucky and useless. But, it is a perfect mixture of the essential acid for its painkiller-ness and the bland base for making it safe and palatable. And very effective at preventing headaches -- just like the templating systems.

      Finally, as you rightly said, "whatever works for one, need not work for someone else." In this case, Kiat, the OP seems to find that a templating system works. I commend Kiat on doing the best to separate logic from display using what works.

        they are neither pure programs, nor pure mark-up but a hybrid of the two, which IMHO combine the bad things of both for little benefit.
        what, in your view, are the "bad things" of programs and mark-up that templating systems combine? I am very curious..

        Mainly the fact that "programmers" still have to look into the layout side of things and "layouters" still have to do some programming (simple as it may be). A templating system still does not fully dissociate logic and layout, whereas the "XML / XSLT / DTD / CSS" combo does.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://315790]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found