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