CatalystX::Declare::Keyword::Controller - Declare Catalyst Controllers


NAME

CatalystX::Declare::Keyword::Controller - Declare Catalyst Controllers


SYNOPSIS

    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 );
        }
            }


DESCRIPTION

This handler module allows the declaration of Catalyst controllers. The controller keyword is an extension of the the CatalystX::Declare::Keyword::Component manpage, which in turn is an extension of class in the MooseX::Declare manpage with all the bells and whistles, including extends, with, method and modifier declarations.

In addition to the keywords and features provided by the MooseX::Declare manpage, you can also specify your controller's actions declaratively. For the whole truth about the syntax refer to the CatalystX::Declare::Keyword::Action manpage.

For controller roles, please see the CatalystX::Declare::Keyword::Role manpage. You can extend controllers with the extends keyword and consume roles via with as usual.


SUPERCLASSES

the CatalystX::Declare::Keyword::Component manpage


METHODS

These methods are implementation details. Unless you are extending or developing the CatalystX::Declare manpage, you should not be concerned with them.

add_namespace_customizations

    Object->add_namespace_customizations (Object $ctx, Str $package)

This method modifier will initialise the controller with the MooseX::MethodAttributes manpage and add the the CatalystX::Declare::Controller::ActionPreparation manpage and the CatalystX::Declare::Controller::DetermineActionClass manpage controller roles before calling the original.

default_superclasses

    Str Object->default_superclasses ()

Returns the Catalyst::Controller manpage as the default superclass for all declared controllers.

add_with_option_customizations

    Object->add_with_option_customizations (
        Object   $ctx,
        Str      $package,
        ArrayRef $roles,
        HashRef  $options,
    )

This hook method will be called by the MooseX::Declare manpage 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.

auto_make_immutable

    Bool Object->auto_make_immutable ()

Returns 0, indicating that the MooseX::Declare manpage should not make this class immutable by itself. We will do that in the add_with_option_customizations method ourselves.

default_inner

    ArrayRef[Object] Object->default_inner ()

A method modifier around the original. The inner syntax handlers inherited by the MooseX::Declare::Syntax::Keyword::Class manpage are extended with instances of the the CatalystX::Declare::Keyword::Action manpage handler class for the action, under and final identifiers.


SEE ALSO

the CatalystX::Declare manpage
the CatalystX::Declare::Keyword::Action manpage
the CatalystX::Declare::Keyword::Component manpage
class in the MooseX::Declare manpage


AUTHOR

See AUTHOR in the CatalystX::Declare manpage for author information.


LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.

 CatalystX::Declare::Keyword::Controller - Declare Catalyst Controllers