If you've worked with CGI.pm for any length of time, you know that forms are automatically sticky when using the HTML generating functions. However, when using alternatives such as HTML::Template or Template Toolkit (which is what I am using), then you have to manually add the 'sticky' action to the templates. This can be a lot of work. For example, I might have some HTML like this:

<input type="text" name="username" value="" maxlength="20" />

For the above very simple snippet, I would change it to:

<input type="text" name="username" value="[% username %]" maxlengt +h="20" />

Naturally, it becomes considerably more complicated when dealing with <select> tags and things like that.

Of course, then I need to go through and write the code that actually grabs and untaints the data and, if incomplete, returns the user to the form with this data already filled in. After writing this stuff for the umpteenth time, I've decided to write a code generator which will create the template and the shell of the CGI script for me. I'm basing this on this code generator that I wrote a while ago. However, this has been a fair amount of work and I'm curious to know if this has already been done. I haven't found any code out there that already does this, but this is so common that I can't imagine that no one has done this before.

Cheers,
Ovid

Vote for paco!

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to Sticky HTML Templates by Ovid

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.