NAME

Catalyst::Plugin::PickComponents - Pick up the components for Catalyst.

SYNOPSIS

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

DESCRIPTION

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

SEE ALSO

Catalyst::Runtime

AUTHOR

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

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.