Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://273164]
[LanX]: perl -d
[LanX]: perlrun
[LanX]: perldb
[LanX]: perldebug

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-05-25 18:48 GMT
Find Nodes?
    Voting Booth?