Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: CGI From Templates

by dash2 (Hermit)
on Jul 10, 2003 at 22:02 UTC ( #273164=note: print w/ replies, xml ) Need Help??


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


Comment on Re: CGI From Templates

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://273164]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2014-11-23 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (127 votes), past polls