in reply to Re^5: Here documents in blocks
in thread Here documents in blocks

It can be quickly implemented, if not quickly learnt. Because these are modules with which I am familiar I would use Template for the templating system

Thanks hippo. Last evening my bedtime reading was Template along with Template::Manual and Templete::Tutorial. Nothing like a bit of light bedtime reading!

I'm convinced!!!

There is an immediate use I see for this solving a problem that is going to need addressing next year - allowing non-techie team members to create company branded emails without having to manipulate HTML.

But...it strikes me that there are a number of Perl templating systems. hippo (and others), if you were starting again today, would you use Template or might you be looking at others?

Replies are listed 'Best First'.
Re: Templating system choice
by hippo (Archbishop) on Dec 21, 2020 at 10:53 UTC

    There is indeed a range of templating modules and this is a good thing because one size does not necessarily fit all. I am happy with Template and would choose it again if starting from scratch because it has everything I need with very few downsides. It has a steeper learning curve that many of the alternatives, but the docs are good and a novice can still construct fairly simple but effective templates using it. It is well maintained, suitable for any output format (HTML, CSV, XML, JSON, plain text, LaTeX source, SVG, you name it), comes with command-line utilities (ttree, tpage) and is widely used.


    🦛

      Thanks hippo. It does seem to me that, whilst Template is powerful and does many things, the documentation is quite clear. Having read the tutorial last evening, I am quite sure I could make it do something useful today.

      Unlike Mojolicious, Template seems more general purpose and not specifically intended for web deployment.

      Template is also already installed on my shared hosting :)

        Template::Toolkit (TT) is the most powerful templating language in Perl; well, maybe it’s really Mason, but that is a digression. It’s not necessarily a good thing.

        My POV: I love and use Template and have for 15ish years. I don’t use it for new projects. It is complex enough that it becomes a mini-language, so you’re not really doing Perl and you’re not really handing off templates to designers or non-coders that they will be able to understand and edit. It can easily make a clean MVC design into spaghetti soup by embedding all three elements in templates.

        Also TT is extremely slow compared to something like Text::Xslate. Xslate has the benefit of being a more pure View. It’s got a few affordances but it doesn’t really rise to the level of mini-language. If you’re using Mojo, its templates might be a better idea than TT.

        The only clear advantage I see in learning TT is that many legacy projects use it, so it might be nice to know when job hunting.

        AFAIK does Mojolicious have a default template engine, but allows to plugin any other.

        I'd wet my feet with Mojo first, then you'll know better which direction you wanna swim.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

      I am happy with Template and would choose it again if starting from scratch because it has everything I need with very few downsides

      This evening I've made a start with Template and it was easier to get something working than I expected. It all just seems to fit together nicely.

      Thanks hippo and everyone else who directed me down the templating path.