Catalyst::Manual::Internals - Catalyst Internals
This document provides an overview of the internals of Catalyst. As Catalyst is still developing rapidly, details may become out of date: please treat this as a guide, and look at the source for the last word.
The coverage is split into initialization and request lifecycle.
Catalyst initializes itself in two stages (I may be wrong in some of the details here - AF):
When the Catalyst module is imported in the main application module it evaluates any options (
-Engine=XXX) and loads any specified plugins, making the application module inherit from the plugin classes. It also sets up a default log object and ensures that the application module inherits from
Catalystand from the selected specialized Engine module.
When the application module makes the first call to
Catalyst::Engine), Catalyst automatically loads all components it finds in the
Module::Pluggable::Fast). A table of actions is built up and added to on subsequent calls to
For each request Catalyst builds a context object, which includes information about the request, and then searches the action table for matching actions.
The handling of a request can be divided into three stages: preparation of the context, processing of the request, and finalization of the response. These are the steps of a Catalyst request in detail; every step can be overloaded to extend Catalyst.
handler prepare prepare_request prepare_path prepare_headers prepare_cookies prepare_connection prepare_action prepare_body prepare_parameters prepare_uploads process finalize finalize_headers finalize_body
These steps are normally overloaded from engine classes, and may also be extended by plugins. Extending means using multiple inheritance with NEXT.
The specialized engine classes populate the Catalyst request object with information from the underlying layer (
CGI::Simple) during the prepare phase, then push the generated response information down to the underlying layer during the finalize phase.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.