1Catalyst::Manual::InterUnsaelrs(C3o)ntributed Perl DocumCeanttaaltyisotn::Manual::Internals(3)
2
3
4
6 Catalyst::Manual::Internals - Catalyst Internals
7
9 This document provides an overview of the internals of Catalyst. As
10 Catalyst is still developing rapidly, details may become out of date:
11 please treat this as a guide, and look at the source for the last word.
12
13 The coverage is split into initialization and request lifecycle.
14
15 Initialization
16
17 Catalyst initializes itself in two stages (I may be wrong in some of
18 the details here - AF):
19
20 1 When the Catalyst module is imported in the main application module
21 it evaluates any options ("-Debug", "-Engine=XXX") and loads any
22 specified plugins, making the application module inherit from the
23 plugin classes. It also sets up a default log object and ensures
24 that the application module inherits from "Catalyst" and from the
25 selected specialized Engine module.
26
27 2 When the application module makes the first call to "__PACK‐
28 AGE__->action()" (implemented in "Catalyst::Engine"), Catalyst
29 automatically loads all components it finds in the $class::Con‐
30 troller, $class::C, $class::Model, $class::M, $class::View and
31 $class::V namespaces (using "Module::Pluggable::Fast"). A table of
32 actions is built up and added to on subsequent calls to "action()".
33
34 Request Lifecycle
35
36 For each request Catalyst builds a context object, which includes
37 information about the request, and then searches the action table for
38 matching actions.
39
40 The handling of a request can be divided into three stages: preparation
41 of the context, processing of the request, and finalization of the
42 response. These are the steps of a Catalyst request in detail; every
43 step can be overloaded to extend Catalyst.
44
45 handle_request
46 prepare
47 prepare_request
48 prepare_connection
49 prepare_query_parameters
50 prepare_headers
51 prepare_cookies
52 prepare_path
53 prepare_body (unless parse_on_demand)
54 prepare_body_parameters
55 prepare_parameters
56 prepare_uploads
57 prepare_action
58 dispatch
59 finalize
60 finalize_uploads
61 finalize_error (if one happened)
62 finalize_headers
63 finalize_cookies
64 finalize_body
65
66 These steps are normally overloaded from engine classes, and may also
67 be extended by plugins. Extending means using multiple inheritance
68 with NEXT.
69
70 The specialized engine classes populate the Catalyst request object
71 with information from the underlying layer ("Apache::Request" or
72 "CGI::Simple") during the prepare phase, then push the generated
73 response information down to the underlying layer during the finalize
74 phase.
75
77 Sebastian Riedel, "sri@oook.de"
78
80 This program is free software, you can redistribute it and/or modify it
81 under the same terms as Perl itself.
82
83
84
85perl v5.8.8 2007-02-28 Catalyst::Manual::Internals(3)