Several days ago some wandering perl monks advised me to learn to use cgi.pm. It seems like a great help in accessing cgi form variables: instead of parsing my environmental variables to get rid of those "%" symbols inserted by CGI, I simply call param() to get my form variables back the way they were entered.
I wonder, however, if it is worthwhile to use CGI.pm to write HTML. For instance, I was surprised to note that the startform method does not include a built-in parameter to give the form a name. (A workaround is to make the first argument to startform be an associate array whose key value is "name").
Because of gotchas like the above the CGI.pm module, when used to write HTML as opposed to parsing form values, might arguably be harder to read than simply printing the desired HTML as a string direct to the browser.
In fact, I came across an old tutorial at the University of South Wales in Australia which stated "CGI.mp is a perl module providing functions/methods that make it easy
- to access data items and other infor available to the CGI script
- to produce HTML output from the script (IMO this is debatable)
Before I start using CGI.pm to write all of my new dynamically generated web pages, I was wondering what is the most common practice of the monks. Do they print their HTML directly to the browser as strings, or do they use CGI.pm's functions for this purpose?