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


in reply to Re^3: Review: CGI::Prototype
in thread Review: CGI::Prototype

I don't think this will work very well. Often, mainscreen() itself took input from some other form. Now I'll need to pile on yet more logic inside mainscreen() to know which runmode it's being called by.

Well, it depends on your mainscreen(). My mainscreen() is always the very first page, which by definition doesn't take any input.

In my years of cgiapp development, I actually haven't needed it any other way. That's probably b/c I don't develop the more complex structures, but I've done countless e-commerce and complicated database applications in this "simple" manner.

Now that I think about it, there are a few other options. Remember in each runmode you got access to the $self (cgiapp class), which you can call its get_current_runmode() to see what runmode it's being called by. You also have access to the CGI object within. You can also stuff/access something inside the cgiapp object with its own param() method. Lastly, you can also pass along arguments to the various runmodes.

You have to put that logic somewhere... ;)