in reply to CGI::Application, have I made a big mistake.

I've only just started playing with CGI::Application so my view may be a little immature in that sense.

I see it as providing a means of presenting views to the user in a nice encapsulated way but allowing pre and post processing on each view (or run mode).

With that in mind, I don't see each run mode as needing to be linear as that requires state management. If you want it to be linear - use state management and encode your path into your run modes. You would want to encode the previous run mode into the session so when you hit the new run mode (or view in my terminology) you can check if you have come from the right place.

Whether you do that in the prerun method or inside the run mode method is upto you. How you encode the session is also upto you. If its just tracking where you have been then something in the URL could be a nice way of doing it as it avoids cookies (but thats a topic for a different node?).

In answer to your direct question, each page view on the screen is a view into your application (or run mode). One view, one run mode, one function. The only place I would stay within a run mode is if the user didn't fill something in properly. I'd then redisplay with an error message. But thats me :).

I wouldn't worry about having a large number of run modes. Frankly it should be proportional (roughly) to the number of facilities you offer to your user. So if they register, login and logout then that would be 2+2+1. Register form mode, thanks for registering mode, login form mode, thanks for logging in mode redirect page (you could make this generic) and a logout mode (you don't need a confirmation screen for this!). Of course that's just off the top of my head.

HTH

SP
  • Comment on Re: CGI::Application, have I made a big mistake.