From: David Baird Date: Tue, 1 Nov 2005 11:07:42 +0000 (+0000) Subject: Fixed description of how Maypole::Application loads plugins, in Mp::Manual::Inheritance. X-Git-Tag: 2.11~114 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=commitdiff_plain;h=ba579915a0d92c87a8d1baad0e7709ea9b3a2559 Fixed description of how Maypole::Application loads plugins, in Mp::Manual::Inheritance. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@404 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Manual/Inheritance.pod b/lib/Maypole/Manual/Inheritance.pod index 1c2fca9..68f2211 100644 --- a/lib/Maypole/Manual/Inheritance.pod +++ b/lib/Maypole/Manual/Inheritance.pod @@ -37,22 +37,23 @@ A minimal Maypole application (such as the Beer database) consists of a custom driver class (BeerDB.pm), a set of auto-generated model classes, and a view class: + THE DRIVER +------- init() is a factory method, 1 Maypole | it sets up the view Maypole::Config <----- config(); | classes model(); init(); *-------+ THE VIEW - | view_object(); -------+ + | view_object(); -------+ | +--------------* setup(); | Maypole::View::Base | | + | + | | | | 1 | - | | Apache::MVC *-----+ +-----> Maypole::View::TT - | | + | (or another view class) - | | | | - | | PLUGINS | - | | + | - | | | +----- or CGI::Maypole - | | BeerDB or MasonX:::Maypole + | | PLUGINS Apache::MVC *-----+ +-----> Maypole::View::TT + | | + + | (or another view class) + | | | | | + | | +-----+-----+ | + | | | | + | | BeerDB +----- or CGI::Maypole + | | or MasonX:::Maypole | | | setup() is a factory method, | it sets up the model @@ -62,10 +63,10 @@ view class: | | Maypole::Model::Base Class::DBI | + + - | | | - +-------> Maypole::Model::CDBI - + - | + | | | + +-------> Maypole::Model::CDBI + + + | +------------+--------+-------+---------+ | | | | | BeerDB::Pub | BeerDB::Beer | BeerDB::Brewery @@ -76,24 +77,20 @@ view class: pub(); BeerDB::Style beer(); beers(); - =head2 What about Maypole::Application - loading plugins -The main job of L is to insert the plugins into the -hierarchy. It ensures that L inherits from the first plugin, which -inherits from the next, etc., until the last plugin inherits from the frontend. - -It is also the responsibility of L to decide which -frontend to use. +The main job of L is to insert the plugins into the +hierarchy. It is also the responsibility of L to decide +which frontend to use. It builds the list of plugins, then pushes them onto the +driver's C<@ISA>, then pushes the frontend onto the end of the driver's C<@ISA>. +So method lookup first searches all the plugins, before searching the frontend +and finally L itself. From Maypole 2.11, L makes no appearance in the inheritance structure of a Maypole application. (In prior versions, L would make itself inherit the plugins, and then insert itself in the hierarchy, but this was unnecessary). -The order of inheritance is the same as the order in which plugins are supplied -in the C statement. - =head2 Who builds the model? First, remember we are talking about the standard, unmodified Maypole here. diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 8de426a..df8d6c8 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -256,7 +256,7 @@ sub setup_database { sub class_of { my ( $self, $r, $table ) = @_; - return $r->config->loader->_table2class($table); + return $r->config->loader->_table2class($table); # why not find_class ? } sub fetch_objects {