Name
Catalyst::Plugin::ConfigComponents - Creates components from config entries
Synopsis
# In your Catalyst application
package YourApp;
use Catalyst qw(ConfigComponents);
__PACKAGE__->setup;
# In your applications config file
<component name="Model::YourModel">
<parent_classes>YourExternal::ModelE<lt>/parent_classes>
<parent_classes>Catalyst::ModelE<lt>/parent_classes>
</component>
# Do not create YourApp::Model::YourModel this module will do it for you
# In a controller this will call your_method in
# the class YourExternal::Model
$result = $c->model( q(YourModel) )->your_method( ... );
Version
This documents version v0.8.$Rev: 1 $ of Catalyst::Plugin::ConfigComponents
Description
When the application starts this module creates Catalyst component class definitions using config information. The defined class inherits from the list of parent classes referenced in the config file
Configuration and Environment
Specify a Plugin::ConfigComponents config option. Attributes are
component_active
-
If the
component_active
config attribute exists and is false the component will not be loaded parent_classes
-
List of classes for the derived component to inherit from
search_extra
-
To add additional search paths, specify a key named search_extra as an array reference. Items in the array beginning with
::
will have the application class name prepended to them setup_method
-
Defaults to
_setup_config_components
, the method to call after the call to Catalyst::setup_components
Subroutines/Methods
setup_components
Calls the setup method (which defaults to "setup_config_components") after the parent method
_setup_config_components
For each config key matching \A Model|View|Controller ::
it checks if the corresponding component already exists, and if it doesn't this method creates it at run-time
The parent class is set to MyApp->config->{ $component }->{parent_classes}
if it exists, Catalyst::$component
otherwise. The parent_classes can be an array ref in which case the defined class will inherit from all classes in the list (multiple inheritance)
Diagnostics
None
Dependencies
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Plugin-ConfigComponents. Patches are welcome
Acknowledgements
Larry Wall - For the Perl programming language
This code was originally posted to the Catalyst mailing list by Dagfinn Ilmari Manns�ker as a patch in response to an idea by Castaway. I thought it would be better as a plugin and have extended it to handle MI
Author
Peter Flanigan, <pjfl@cpan.org>
License and Copyright
Copyright (c) 2013 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE