General comments:
The getHTML() method is okay to have, but what you will probably want is a getform() method (or getHTMLform() perhaps) that returns only the part from <form up through </form>. That allows multiple forms on the same page (only one of which will be submitted at any time, of course -- each form can have a hidden input that indicates which form it is, to prevent any ambiguity), arbitrary additional content, and, in general, more flexibility. Make sure your form html is wellformed xhtml, too. Ideally it should validate.

For instance, one could create a FormManager::Date component which consists of three select boxes for month/day/year. In your code, you could treat this as a single input.

That sounds to me like it ought to be included (eventually), because it would be a generally useful feature. Bonus points if it has separate methods to return the date in MySQL format or the way localtime does, depending on what the calling code is going to do with the data.

Validation

That alone, IMO, makes it worth having in addition to CGI. Your methods for getting the form input could internally rely on CGI.pm if it will do what you need, but putting the validation layer on top is a significant improvement. If there's not another well-done module out there that handles this, then yours would be a Good Thing.

To go a little further with that... on failure, it ought to generate a reference (to a hash or something; the internal implementation is unimportant, since it can be treated by the calling code as a magic token) that can be retrieved by the calling code and passed to the next call to getHTMLform() (or whatever) to cause the sections of the form relevant to the failure to be marked up with a "validationfailure" class, so that the calling code can easily style them with a red outline or somesuch.


for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

In reply to Re: Is there room for YAHTMLM? by jonadab
in thread Is there room for YAHTMLM? by jbeninger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.