Basic, no-frills controller for MVC, fairly generic but optimized for web usage.
The idea is, to create a Controller and then "pump" requests through the controller, the return value will be a View object (something with a display() method)
It is important to realize, the Controller may persist beyond a single request (particularly in mod_perl or fastcgi environments)
Constructor, you might construct one of these and keep it around for awhile. (Keeping in mind each ACTION may be persistent)
Parameters:
Conf => Config::General (With -ExtendedAccess => 1)
DispatchMap => { DO_WHAT => 'method_name' }
Persist => 0|1 telling
Returns TRUE if this is a persistent controller. (One might use this in init() to require stuff that wouldn't normally be used until runtime and/or connect to database handles.
This only returns the value of Persist set in the constructor.
This is called just before returning an object from New. You might, for example, use it to create a database connection, etc.. it is called once and only during object construction.
Get the Config::General object as passed in constructor.
Get the dispatch mappings. (this originates in the conf file)
Run the controller, should return a View object for display.
Run this requests action. You might override this if you need to do special things before / after each action is handled.
Locate an action to run, this implementation checks the Config::General's dispatch
section for SOME_VARIABLE_NAME do_method_name. If a form variable called
SOME_VARIABLE_NAME is found, it will return do_method_name
You might override this method if you prefer a ?go=method or if you perfer
to use the PATH_INFO .
Default action when none other are found.
Override this and have it perhaps, return a Main type of page.