in reply to CGI::Application next run mode buttons?

IMHO, CGI::Application is a state machine for an application model and adding view code (buttons and links) to the model by subclassing CGI::Application is (questionably) a design flaw. Better to make another class and seperate your model and view.
  • Comment on Re: CGI::Application next run mode buttons?

Replies are listed 'Best First'.
Re2: CGI::Application next run mode buttons?)
by Solo (Deacon) on Apr 02, 2004 at 22:27 UTC
    It boils down to which should be responsible for possible state transitions: the controller or the view?

    I think controller. Therefore, I need a way for the controller to tell the view which state transitions are allowed, in order for the view to correctly prompt the user. Since this needs to happen for every state (except an end state), I think it makes sense to put them in the run_modes(...) declaration. I'm looking for other ideas.

    How the view takes the 'possible next states' data and presents it doesn't matter to me. But the complicated part is each view component needs the data in a different format... H::T will need it one way, TT2 another, etc. I'm using the form rendering piece of CGI::FormBuilder at the moment for 'brevity' in my example (a bad choice I now see). I will create a .tmpl file and adjust my example to it.

    How to abstract the possible next states data and how to have 'plugin' support for different view components is what I hope to discuss. But I need to make a better case and a more detailed write up will be forthcoming ;)

    At least that's how I've been looking at it.

    --Solo