This package makes up the core of Gestalt, the MCV framework.
It is made up of a Dispatcher, Base Controller, Base Table, Base Row and a Paginator,
and also has a project generater called 'gestalt'.
The dispatcher, as its name suggests, dispatches requests to the appropriate
controller (which could be generated by gestalt, or hand-crafted).
The generated controller is actually quite bare-bones, as it inherits most of its
functionality (CURD operations) from the Base Controller, Apache::Request::Controller
The Controller's job is to interact with the various other objects (mostly tables,
rows and templates - aka views) to make sure that the request is fulfilled sucessfuly.
The Base Table provides an interface to the data that represents a database table,
for example which columns are primary keys, which tables refer to this table,
and which foreign keys this table has.
The generated table provides the data itself, and inherits the interface from the
Base Table.
Likewise, the Base Row provides an interface to the rows within a given table,
allowing access to the data stored within an actual row.
The paginator does not have a generated counter-part, as its purpose is to provide
a book-like interface to viewing lots of "things" (such as rows).
Plugging in to Apache:
If your application is called 'mySpiffyApp' then add this to your httpd.conf:
#####
SetHandler perl-script
PerlHandler Web::Dispatcher
SetEnv DispatcherConf /data/mySpiffyApp.cfg
PerlRequire conf/startup.pl
#####
The startup.pl script should 'use' all generated Controllers/Tables/Rows as well
as the dispatcher. This is because the dispatcher does not load modules of its
own accord because that would be a security risk (URI's map to module names)
For each application that your dispatcher dispatches to, you need to have your
own config file, the name of which is defined by the environment variable
"DispatcherConf". This configuration file defines things such as which database
is used for this app, where the templates are stored, and what the default
controller is called. An example is here:
#####
db_dsn="DBI:Pg:database=devicedb;host=127.0.0.1"
db_username=myUserName
db_password=myPassword
templatePath="/data/templates/mySPiffyApp"
defaultController=Devices
######