3 Catalyst::Manual::Internals - Catalyst Internals
7 This document provides an overview of the internals of
8 Catalyst. As Catalyst is still developing rapidly, details
9 may become out of date: please treat this as a guide, and
10 look at the source for the last word.
12 The coverage is split into initialization and request lifecycle.
16 Catalyst initializes itself in two stages (I may be wrong in some of
17 the details here - AF):
23 When the Catalyst module is imported in the main application
24 module it evaluates any options (C<-Debug>, C<-Engine=XXX>)
25 and loads any specified plugins, making the application module
26 inherit from the plugin classes. It also sets up a default log
27 object and ensures that the application module inherits from
28 C<Catalyst> and from the selected specialized Engine module.
32 When the application module makes the first call to C<< __PACKAGE__->action() >>
33 (implemented in C<Catalyst::Engine>), Catalyst automatically loads all
34 components it finds in the C<$class::Controller>, C<$class::C>,
35 C<$class::Model>, C<$class::M>, C<$class::View> and C<$class::V>
36 namespaces (using C<Module::Pluggable::Fast>). A table of actions is built up
37 and added to on subsequent calls to C<action()>.
42 =head2 Request Lifecycle
44 For each request Catalyst builds a I<context> object, which includes
45 information about the request, and then searches the action table for matching
48 The handling of a request can be divided into three stages: preparation of the
49 context, processing of the request, and finalization of the response. These
50 are the steps of a Catalyst request in detail; every step can be overloaded to
69 These steps are normally overloaded from engine classes, and may also be
70 extended by plugins. Extending means using multiple inheritance with L<NEXT>.
72 The specialized engine classes populate the Catalyst request object with
73 information from the underlying layer (C<Apache::Request> or C<CGI::Simple>)
74 during the prepare phase, then push the generated response information down to
75 the underlying layer during the finalize phase.
80 Sebastian Riedel, C<sri@oook.de>
84 This program is free software, you can redistribute it and/or modify it under
85 the same terms as Perl itself.