http://www.perlmonks.org?node_id=273164


in reply to CGI From Templates

I think it's an excellent idea. I had similar thoughts myself, congrats for doing it. Don't know about Form::Magick at all.

For extending your system: I'd avoid inheritance. Split your system up into the core functionality (the autoform parsing from a template) and some surrounding modules that use this. For example, one module could get the parsed form and enter default values from somewhere (e.g. a database). Another module could look at the possible form inputs and autocreate an appropriate database table in a Alzabo-ish kind of way. Another one could create a plain HTML report with some values from somewhere.

If you enforce this separation in your own code, it'll be easy for other people to create new modules like what you've got. You could provide some base classes for simplicity:

FormParser (the core)
FormParser::SubmittedHandler (class to handle submitted data, basically matches up the HTTP POST data with the FormParser structure)
FormParser::CreateReport (abstract base class: talks to FP::SH and creates some kind of static report based on the data and the HTML presentation of the form)
FormParser::SaveData (abstract base class: talks to FP::SH and saves the data in some way. Could also provide methods for a FormParser object to get the data back)

Now I'll take a completely different tack. Don't worry about all this clever stuff, just do something that works. Psychologically you'll be happier and you can then see how to extend it, make it cleverer etc. Especially if people are using your original.
A massive flamewar beneath your chosen depth has not been shown here