Here is my initial attempt at a module FormParser. Its crude and ugly and its not an object yet, just a function housed in there. Next I'm working on making it an object (dear god) then i want to add handling for tags. So like a handler can be registered for each tag..

AddHandler("text",&FormText,&DisplayText)

where the first parameter is the tag, the second is a code ref for the form tag, and the third is the code ref for normal display.

I also wanna be able to snag attributes....i.e. have <select options="&listem"> and have the listem function called. It needs to be able to snag all tags of "select" with attribute of "options" and it needs to be passed the HTML entity to add the <option value="">name</option> tags inside.

I guess then each handler should accept a reference to the HTML::Element that it is handeling, and return that reference back.

I'm just kinda feeling out my ideas here as i implement them, for a kinda thought process record, and to get any feed back along the way. Better ways to handle, different ways, draw backs to my current way, etc. Please let me know if this is improper use of PM :-)

Update: Converted Module to class
Thanks,
Eric Hodges

In reply to Re: CGI From Templates by eric256
in thread CGI From Templates by eric256

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.