Catalyst::Plugin::PickComponents - Pick up the components for Catalyst.
use Catalyst qw/ PickComponents /; # configure which dir and modules to be loaded __PACKAGE__->config->{pick_components} = { paths => [ '::Controller', '::Model' ], modules => [ 'MyApp::View::TT' ], expect_paths => [ '::Controller::Admin', '::Controller::Search' ], expect_modules => [ 'MyApp::Controller::Admin', 'MyApp::Controller::Search' ], } # after ConfigLoader or something else, in YAML myapp.yml or myapp_local.yml pick_components: paths: - ::Controller - ::Model modules: - MyApp::View::TT expect_paths: - ::Controller::Admin - ::Controller::Search expect_modules: - MyApp::Controller::Admin - MyApp::Controller::Search
This plugin gives you the rights to pick up what modules loaded for a certain application instance.
When source perl modules expand quickly, we might want to load different modules into different servers. For sure we can remove useless modules in different servers, but I'm afraid that it's hard to maintain and configure.
example:
# http://www.myapp.com/, myapp_local.yml pick_components: paths: - ::Controller - ::Model modules: - MyApp::View::TT expect_paths: - ::Controller::Admin - ::Controller::Search expect_modules: - MyApp::Controller::Admin - MyApp::Controller::Search # http://search.myapp.com/, myapp_local.yml pick_components: paths: - ::Controller::Search - ::Model modules: - MyApp::View::TT - MyApp::Controller::Search - MyApp::Controller::Root expect_paths: - ::Controller::Admin expect_modules: - MyApp::Controller::Admin # http://admin.myapp.com/, myapp_local.yml pick_components: paths: - ::Controller::Admin - ::Model modules: - MyApp::View::TT - MyApp::Controller::Admin - MyApp::Controller::Root expect_paths: - ::Controller::Search expect_modules: - MyApp::Controller::Search
Catalyst::Runtime
Fayland Lam, <fayland at gmail.com>
<fayland at gmail.com>
Copyright 2007 Fayland Lam, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Plugin::PickComponents, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::PickComponents
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::PickComponents
For more information on module installation, please visit the detailed CPAN module installation guide.