in reply to why use OO nature in CGI?

why would someone go through the extra TROUBLE in using the OO aspect of CGI instead of just hard coding the HTML manually using heredocs?
You mean HTML tag generation by functions/methods, instead of by embedded literal HTML? Oh, some reasons:

To me, the latter point would be its major selling point, thought enforcement of proper tag nesting is a good second.

Replies are listed 'Best First'.
Re^2: why use OO nature in CGI?
by siracusa (Friar) on May 22, 2005 at 13:56 UTC
    You mean HTML tag generation by functions/methods, instead of by embedded literal HTML?
    There's actually a third option that I prefer for HTML forms in particular: mutable widget objects that serialize to HTML (or XHTML) on request. The memory overhead of this approach is slightly higher than HTML-generator functions, but this is far outweighed by the increased flexibility and, most importantly, potential for reuse. Fields with input and output filters, auto-inflate/deflate of values, compound fields (single "logical" fields made up of multiple "physical" HTML fields), etc., all make dealing with large, complex forms so much easier, IME.