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


Catalyst-Plugin-PickComponents documentation  | view source Contained in the Catalyst-Plugin-PickComponents distribution.

Index


NAME

Top

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

SYNOPSIS

Top

    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

Top

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

Top

Catalyst::Runtime

AUTHOR

Top

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Top


Catalyst-Plugin-PickComponents documentation  | view source Contained in the Catalyst-Plugin-PickComponents distribution.