Maypole::Model::CDBI - Model class based on Class::DBI
This is a master model class which uses Class::DBI to do all the hard work of fetching rows and representing them as objects. It is a good model to copy if you're replacing it with other database abstraction modules.
It implements a base set of methods required for a Maypole Data Model.
It inherits accessor and helper methods from Maypole::Model::Base.
When specified as the application model, it will use Class::DBI::Loader to generate the model classes from the provided database. If you do not wish to use this functionality, use Maypole::Model::CDBI::Plain which will instead use Class::DBI classes provided.
Set the class you use to untaint and validate form data Note it must be of type CGI::Untaint::Maypole (takes $r arg) or CGI::Untaint
Adds model as superclass to model classes (if necessary)
Inherited from Maypole::Model::CDBI::Base
Action methods are methods that are accessed through web (or other public) interface.
If there is an object in $r->objects, then it should be edited with the parameters in $r->params; otherwise, a new object should be created with those parameters, and put back into $r->objects. The template should be changed to view, or edit if there were any errors. A hash of errors will be passed to the template.
$r->objects
$r->params
view
edit
Inherited from Maypole::Model::CDBI::Base.
This action deletes records
This action method searches for database records.
The list method fills $r->objects with all of the objects in the class. The results are paged using a pager.
list
This method is inherited from Maypole::Model::Base and calls setup_database, which uses Class::DBI::Loader to create and load Class::DBI classes from the given database schema.
The $opts argument is a hashref of options. The "options" key is a hashref of Database connection options . Other keys may be various Loader arguments or flags. It has this form: { # DB connection options options { AutoCommit => 1 , ... }, # Loader args relationships => 1, ... }
returns class for given table
Maypole, Maypole::Model::CDBI::Base.
Maypole is currently maintained by Aaron Trevena.
Simon Cozens, simon#cpan.org
simon#cpan.org
Simon Flack maintained Maypole from 2.05 to 2.09
Sebastian Riedel, sri#oook.de maintained Maypole from 1.99_01 to 2.04
sri#oook.de
You may distribute this code under the same terms as Perl itself.
To install Maypole, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Maypole
CPAN shell
perl -MCPAN -e shell install Maypole
For more information on module installation, please visit the detailed CPAN module installation guide.