Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Issues and Advantages module Text::Template

by itztheMonk (Acolyte)
on Jun 02, 2017 at 06:19 UTC ( [id://1191916]=perlquestion: print w/replies, xml ) Need Help??

itztheMonk has asked for the wisdom of the Perl Monks concerning the following question:

Hi
I would like to include a template engine to my project ( CGI perl ). My project features includes shopping carts, payments etc. Other parts of the projects is written in pure perl. So my options is limited to solutions without frameworks. But wish to include templating to separate code and html. After few research i have found the the following module which seems the best fit.

http://search.cpan.org/~mschout/Text-Template-1.47/lib/Text/Template.pm

Also code will be managed by perl developers. So inline perl is a plus.

If any one used this before, please share your experiences. My primary concerns include maintainability, scalability and reliability. Also plans to use a custom delimiter. please share your thoughts on which delimetter should I choose ( my thoughts {% and %} ).

Replies are listed 'Best First'.
Re: Issues and Advantages module Text::Template
by hippo (Bishop) on Jun 02, 2017 at 07:41 UTC
    If any one used this before, please share your experiences.

    For starters, our very own Reviews section includes Text::Template. More generally, there's an entire site for that. Reading those suggests that it is in the same vein as Embperl and PHP and will likely suffer from the same drawbacks (or at least could, if so abused). As ever, YMMV.

Re: Issues and Advantages module Text::Template
by sundialsvc4 (Abbot) on Jun 02, 2017 at 14:21 UTC

    You asked for personal opinions, therefore, I will offer mine.

    Usually, in real life, the templating decision – including plenty of “home-grown” – has been made for you by an unknown predecessor.   I have seen Text::Template in use, although I observe Template::Toolkit more frequently.

    One issue that should be of concern is, not to let the project “fall into the PHP rabbit-hole,” where there is no separation-of-concerns between the preparation of material to be displayed, and the display of it.   By their design, tools such as Text::Template are more prone to this.   The problem becomes that, now, the total source-code becomes shared among a large number of modules – templates and otherwise – which now become coupled.   When a change inevitably needs to be made (marketing departments are never still ...), that change can “ripple” through a large number of files – and, if there are very many, you are quite likely to overlook at least one of them.   Especially in the hands of a former-PHP person, the temptations become very strong.

    Functionally ... performance-wise ... all of the main-stream tools are solid work-horses which earn their oats every day.   You should look the project over very carefully, and loop-in the other developers and interested parties so that you all make the final decision by consensus.   If time allows, I would encourage you to ask several developers other than yourself to each construct a short program that produces the HTML for a simple page, each one using a separate tool.   Then, circle-the-wagons and have each one of them present and discuss what they did.   As long as you they stick to the main stream, none of the choices that could be made will be “wrong,” but any decision that is made will be forevermore.

Re: Issues and Advantages module Text::Template (opinions)
by Anonymous Monk on Jun 02, 2017 at 07:04 UTC

    Hi,

    Your question is very funny

    because your school assignment is not important

    Nobody targeting CGI worries about maintainability, scalability and reliability and delimiter because how could any of that stuff be important if your plan is to target CGI?

    How is delimiter even a thought you spend more than one second considering unless this is your very first piece of code you had to write ever?

    You can't outsource experience, you have to live it, thats the point of homework like this, so

    Pick any templating system out of a hat and try to use it

    Spend a day writing code, then "throw it all out" (start a new directory, version2)

    Tomorrow pick another templating system out of a hat and start writing code from scratch

      I understand "target CGI" to mean "output the HTML myself", and "run via the CGI protocol" (instead of some kind of server, like mod_perl).

      So I don't see why one shouldn't or couldn't think about maintainability, scalability, reliability and template delimiters when targetting CGI.

      Also, while I fully support that experience is something you have to do yourself, there certainly are ideas that are so bad that they don't need to be explored. But you don't give any actual arguments as to why CGI shouldn't be explored, and you don't give any arguments as to why the choice of delimiter doesn't matter.

        Aw awww :)

        So you don't see the humor ? You think its not a student? And you think I'm against CGI?

        Its like asking tell me the best way to build a car thats the fastest and the most fuel efficient and bestest it can be ... also mechanics will be working on it so engine accessible from the drivers seat is a plus

        How can you seriously respond to such a question ? Oh right, you didn't :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1191916]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found