CatalystX::ComponentsFromConfig::Role::PluginRole - parameterised role for plugins to create components from configuration
version 1.002
Here we document implementation details, see CatalystX::ComponentsFromConfig::ModelPlugin and CatalystX::ComponentsFromConfig::ViewPlugin for usage examples.
setup_components
after the normal Catalyst components setup, call _setup_dynamic_${component_type}.
after
_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.
$app->config
${component_type}_from_config
base_class
CatalystX::ComponentsFromConfig::${component_type}Adaptor
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.
'model'
'view'
'controller'
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.
Model::
View::
Controller::
Tomas Doran (t0m) <bobtfish@bobtfish.net>
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>
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.
To install CatalystX::ComponentsFromConfig, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::ComponentsFromConfig
CPAN shell
perl -MCPAN -e shell install CatalystX::ComponentsFromConfig
For more information on module installation, please visit the detailed CPAN module installation guide.