-
-
27 May 2009 23:49:12 UTC
- Distribution: Catalyst-Manual
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Clone repository
- Issues (16)
- Testers (271 / 1 / 0)
- Kwalitee
Bus factor: 12- License: perl_5
- Activity
24 month- Tools
- Download (165.24KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Catalyst::Manual::Internals - Catalyst Internals
DESCRIPTION
This document provides a brief 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.
Initialization
Catalyst initializes itself in two stages:
When the Catalyst module is imported in the main application module it evaluates any options (
-Debug
,-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 fromCatalyst
and from the selected specialized Engine module.When the application module makes the first call to
__PACKAGE__->action()
(implemented inCatalyst::Engine
), Catalyst automatically loads all components it finds in the$class::Controller
,$class::C
,$class::Model
,$class::M
,$class::View
and$class::V
namespaces (usingModule::Pluggable
). A table of actions is built up and added to on subsequent calls toaction()
.
Request Lifecycle
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.
handle_request prepare prepare_request prepare_connection prepare_query_parameters prepare_headers prepare_cookies prepare_path prepare_body (unless parse_on_demand) prepare_body_parameters prepare_parameters prepare_uploads prepare_action dispatch finalize finalize_uploads finalize_error (if one happened) finalize_headers finalize_cookies finalize_body
These steps are normally overloaded from engine classes, and may also be extended by plugins. For more on extending Catalyst, see Catalyst::Manual::ExtendingCatalyst.
The specialized engine classes populate the Catalyst request object with information from the underlying layer (
Apache::Request
orCGI::Simple
) during the prepare phase, then push the generated response information down to the underlying layer during the finalize phase.AUTHOR
Sebastian Riedel,
sri@oook.de
COPYRIGHT
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Catalyst::Manual, copy and paste the appropriate command in to your terminal.
cpanm Catalyst::Manual
perl -MCPAN -e shell install Catalyst::Manual
For more information on module installation, please visit the detailed CPAN module installation guide.