I don't use the HTML-generation functionality of the CGI.pm module for a simple reason: Separation of code and presentation of data. I try to design (web-)applications with the possibility that sometime in the future I may have to change the user-interface from a browser to, say, a Tk interface. Using a templating module (like Template Toolkit) which you only have to feed a reference to your data makes it much easier to replace the user-interface than grovelling through scripts and modules which have (possibly bad) HTML in them (and using the CGI HTML capabilities is the same as having plain HTML in your code, IMO).
So, apart from that it's probably much easier to maintain an application which uses a templating system, it also makes the design better by separating out the data and the means to display that data.
Arjen
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|