No such thing as a small change | |
PerlMonks |
Re: CGI.pm and HTML5by sundialsvc4 (Abbot) |
on May 04, 2013 at 16:08 UTC ( [id://1032054]=note: print w/replies, xml ) | Need Help?? |
The CGI module is exactly what it promises to be – which is to say, “not much.” It literally consists only of “sugar” for the various elements of the HTTP protocol ... in the context of a vanilla-CGI script. And yet, it is currently maintained, and everything that is said about it in the DESCRIPTION section of the CPAN page is still true: CGI.pm is a stable, complete and mature solution for processing and preparing HTTP requests and responses. Major features including processing form submissions, file uploads, reading and writing cookies, query string generation and manipulation, and processing and preparing HTTP headers. Some HTML generation utilities are included as well. As you feared, if you want a DOCTYPE or anything-else in the HTML header, or anywhere else, you have to do it yourself. You will need to use a debugger on the client side (e.g. Firebug) to actually examine precisely what the HTML returned is. (Or, you can use curl.) It definitely would be worth your time to explore other options, like the CGI::Application family ... which, no surprise here really, uses CGI to do its heavy lifting, yet provides both a structured framework for “the whole enchilada” and introduces the concept of plugins, providing for a very helpful “separation of concerns.” I suggest it because it is a relatively modest step from your present-state, yet offers excellent performance.
In Section
Seekers of Perl Wisdom
|
|