The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CatalystX::ComponentsFromConfig::Role::PluginRole - parameterised role for plugins to create components from configuration

VERSION

version 1.002

DESCRIPTION

Here we document implementation details, see CatalystX::ComponentsFromConfig::ModelPlugin and CatalystX::ComponentsFromConfig::ViewPlugin for usage examples.

METHODS

setup_components

after the normal Catalyst components setup, call _setup_dynamic_${component_type}.

_setup_dynamic_${component_type}

Loops through $app->config, looking for sections that don't correspond to existing components. For each one, uses CatalystX::InjectComponent to create the component, using as base class either the one set globally in the ${component_type}_from_config section (key base_class), or the one set locally in the base_class value. If neither is set, the default CatalystX::ComponentsFromConfig::${component_type}Adaptor is used.

ROLE PARAMETERS

component_type

The type of component to create, in lower case. Usually one of 'model', 'view' or 'controller'. There is no pre-packaged plugin to create controllers, mostly because I could not think of a sensible adaptor for them.

skip_mvc_renaming

By default CatalystX::InjectComponent renames components that don't start with one of Model::, View:: or Controller:: according to which corresponding Catalyst component base class they inherit from. To avoid this (for example if your component is not a model, view or controller), set this to true.

METHODS

AUTHORS

  • Tomas Doran (t0m) <bobtfish@bobtfish.net>

  • Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Net-a-porter.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.