Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: HTML::Template Form Usage

by rob_au (Abbot)
on Jan 03, 2002 at 04:39 UTC ( [id://135869]=note: print w/replies, xml ) Need Help??


in reply to HTML::Template Form Usage

since I don't want to mirror too many cases or loops in the template that could have been done in the acutal .pl/.cgi program

I have to say that to a certain extent you are ignoring the true idea behind template integration to separate design and code. The usage of the CGI generated HTML to fill in HTML::Template variables defeats the purpose of using HTML::Template in the first place.

Imagine, the scenario where you are working in a development team where it is decided that your role is solely to develop code and the role of HTML and interface design is assigned to someone else. The best way to provide the flexibility of allowing these two roles to co-exist effectively is decided to be to make use of a templating system such as HTML::Template or Template::Toolkit. So both you and the web designer set about your respective tasks yet when it comes to integrating the form template with the CGI script, the web designer finds that their work has been invalidated through your usage of CGI-generated HTML in the template variables passed. Furthermore, think of the headache 18 months down the track when you have moved on to other things and the company wants to hire a web designer to redesign their web page ... Your usage of CGI-generated HTML in the template variables would create much heartache for the poor designer hired to edit the HTML templates.

This post is designed merely to get you thinking about the design philosophy you are taking with this usage of HTML::Template - You are rightly attempting to give yourself every opportunity to separate your design and code, yet at the same time hobbling the two together through the generation of HTML formatting by CGI rather than using the in-built templating features of HTML::Template. Admittedly in this instance, your generation of HTML by way of CGI is basic, but when I read through your code, the hairs at the back of my neck still stood on end at the thought of what it represented.

If you are finding HTML::Template too limiting with regard to template logic and layout, you may want to consider the more powerful Template::Toolkit option. But try to avoid generating your HTML from your CGI script if you are using a templating system - You are merely taking a step backwards and again hobbling code and design back together.

 

Update

I had a closer look at your code and template and it appears that there is nothing there which you are displaying as a result of code generation. I'm aware that this may be a cut-down example, but if you are not actually displaying anything in your HTML page that is a result of code or process logic, then why not just stick with a plain HTML page - The real power of templating is realised when you are seeking to incorporate code or process output into a display or page, not simply page formatting.

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-28 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found