Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Lately, most of the code I write for CGI's generally follows the same basic design pattern:

  • Receive the values with
  • Validate and detaint the parameters with HTML::FormValidator.
  • <shamless plug>Build a multi-dimensional hash with CGI::State</shameless plug>
  • If there is an error, or missing field, use HTML::FillInForm and HTML::Template to re-fill in the form with the submitted data and print an error.
  • Do some work, usually with DBI, etc
  • Use HTML::Template to display a page to the user either prompting the user for more info, or display the results of the work.

(I hear that Apache::Pagekit encapsulates alot of this into a single framework, but I am not convinced that the platform is stable enough for my needs yet.)

The great thing about HTML::FormValidator is that you can set up "validation profiles". By this I mean you can built a set of rules for a newsletter subscription, or an order submission, for example. The design of the module allows it to share these pre-made profiles with many other scripts. Once you write a profile for what I call a "web object", you can reuse it over and over for the same type of data.

If your 40-odd scripts are asking for similar types of data, using this module might be a good way to factor out all the validation and detainting code.

Update: Sorry, I see that you have 40 elements per form, not scripts. Either way, this module *will* save you enough time, so you can concentrate on Quake more =)

In reply to (dkubb) Re: (3) OO Form Validating by dkubb
in thread Automatic Generation of Form Handling Code by Ovid

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2023-05-30 13:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found