CatalystX::Declare::Keyword::Controller - Declare Catalyst Controllers
controller MyApp::Web::Controller::Example extends MyApp::Web::ControllerBase::CRUD with MyApp::Web::ControllerRole::Caching { $CLASS->config(option_name => 'value'); has attr => (is => 'rw', lazy_build => 1); method _build_attr { 'Hello World' } action base as ''; final action site, under base { $ctx->response->body( $self->attr ); } }
This handler module allows the declaration of Catalyst controllers. The controller keyword is an extension of the CatalystX::Declare::Keyword::Component, which in turn is an extension of "class" in MooseX::Declare with all the bells and whistles, including extends, with, method and modifier declarations.
controller
extends
with
method
In addition to the keywords and features provided by MooseX::Declare, you can also specify your controller's actions declaratively. For the whole truth about the syntax refer to CatalystX::Declare::Keyword::Action.
For controller roles, please see CatalystX::Declare::Keyword::Role. You can extend controllers with the extends keyword and consume roles via with as usual.
These methods are implementation details. Unless you are extending or developing CatalystX::Declare, you should not be concerned with them.
Object->add_namespace_customizations (Object $ctx, Str $package)
This method modifier will initialise the controller with MooseX::MethodAttributes and add the CatalystX::Declare::Controller::ActionPreparation and CatalystX::Declare::Controller::DetermineActionClass controller roles before calling the original.
Str Object->default_superclasses ()
Returns Catalyst::Controller as the default superclass for all declared controllers.
Object->add_with_option_customizations ( Object $ctx, Str $package, ArrayRef $roles, HashRef $options, )
This hook method will be called by MooseX::Declare when with options were encountered. Since 0.011 the roles will be applied all at once.
This method will also add a callback to make the controller immutable to the cleanup code parts unless is mutable was specified.
is mutable
Bool Object->auto_make_immutable ()
Returns 0, indicating that MooseX::Declare should not make this class immutable by itself. We will do that in the "add_with_option_customizations" method ourselves.
0
ArrayRef[Object] Object->default_inner ()
A method modifier around the original. The inner syntax handlers inherited by MooseX::Declare::Syntax::Keyword::Class are extended with instances of the CatalystX::Declare::Keyword::Action handler class for the action, under and final identifiers.
action
under
final
See "AUTHOR" in CatalystX::Declare for author information.
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.
To install CatalystX::Declare, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Declare
CPAN shell
perl -MCPAN -e shell install CatalystX::Declare
For more information on module installation, please visit the detailed CPAN module installation guide.