+Maypole::Manual::Model - Maypole Model Classes
+
+=head1 DESCRIPTION
+
+Maypole's model classes provide an interface to your data store.
+In principle Maypole can connect to pretty much any data source,
+but the default model is based on the popular L<Class::DBI> object
+interface that uses the near-universal L<DBI> Perl interface to databases.
BeerDB->setup("dbi:mysql:beerdb");
C<setup> is a Maypole method, and it hands its parameter to the model
BeerDB->setup("dbi:mysql:beerdb");
C<setup> is a Maypole method, and it hands its parameter to the model
that's what C<Maypole::Model::CDBI>, the C<Class::DBI>-based model
expects. C<Maypole::Model::CDBI> has a method called C<setup_database>
that creates all the C<Class::DBI> table classes after connecting to the
database with that connect string. It does this by using
C<Class::DBI::Loader>, a utility module which asks a database
about its schema and sets up classes such as C<BeerDB::Beer> to inherit
that's what C<Maypole::Model::CDBI>, the C<Class::DBI>-based model
expects. C<Maypole::Model::CDBI> has a method called C<setup_database>
that creates all the C<Class::DBI> table classes after connecting to the
database with that connect string. It does this by using
C<Class::DBI::Loader>, a utility module which asks a database
about its schema and sets up classes such as C<BeerDB::Beer> to inherit
Now it gets interesting. The names of these classes are stashed away in
the application's configuration, and then Maypole forcibly has these
Now it gets interesting. The names of these classes are stashed away in
the application's configuration, and then Maypole forcibly has these
-We'll meet most of these goodies in L<StandardTemplates.pod>, where we
-explain how C<Maypole::Model::CDBI> works.
+We'll meet most of these goodies in the
+L<Standard Templates and Actions|Maypole::Manual::StandardTemplates>
+chapter, where we explain how C<Maypole::Model::CDBI> works.
default actions. So what's an action, and why are they useful?
=head2 Extending a model class with actions
default actions. So what's an action, and why are they useful?
=head2 Extending a model class with actions
that. Firstly because it doesn't actually pass the parameter C<20>, but
it passes an object representing row 20 in the database, but we can
gloss over that for the second. No, the real issue is that Maypole does
that. Firstly because it doesn't actually pass the parameter C<20>, but
it passes an object representing row 20 in the database, but we can
gloss over that for the second. No, the real issue is that Maypole does
somewhat insecure.
Instead, Maypole makes a distinction between the kind of methods that
only the class itself and other Perl code can call, and the kind of
methods that anyone can call from a URL. This latter set of methods are
somewhat insecure.
Instead, Maypole makes a distinction between the kind of methods that
only the class itself and other Perl code can call, and the kind of
methods that anyone can call from a URL. This latter set of methods are
Maypole model classes like C<Maypole::Model::CDBI> come with a
relatively handy set of actions which are all you need to set up a CRUD
Maypole model classes like C<Maypole::Model::CDBI> come with a
relatively handy set of actions which are all you need to set up a CRUD
database front-end: viewing a row in a database, editing it, adding a
new one, deleting, and so on. The most important thing about Maypole,
though, is that it doesn't stop there. You can add your own.
database front-end: viewing a row in a database, editing it, adding a
new one, deleting, and so on. The most important thing about Maypole,
though, is that it doesn't stop there. You can add your own.