CatalystX::Component::Traits(3pm)

CatalystX::Component::Traits3pm

Automatic trait loading and resolution for catalyst components

Usage

    package Catalyst::Model::SomeModel;
    with 'CatalystX::Component::Traits';
    package MyApp::Model::MyModel;
    use parent 'Catalyst::Model::SomeModel';
    package MyApp;
    __PACKAGE__->config('Model::MyModel' => {
        traits => ['SearchedForTrait', '+Fully::Qualified::Trait']
    });

Overview

Adds a "COMPONENT" in Catalyst::Component method to your Catalyst component base class that reads the optional "traits" parameter from app and component config and instantiates the component subclass with those traits using "new_with_traits" in MooseX::Traits from MooseX::Traits::Pluggable.

Trait merging

Traits from component class config and app config are automatically merged if you set the "_trait_merge" attribute default, e.g.:

    has '+_trait_merge' => (default => 1);

You can remove component class config traits by prefixing their names with a "-" in the app config traits.

For example:

    package Catalyst::Model::Foo;
    has '+_trait_merge' => (default => 1);
    __PACKAGE__->config->{traits} = [qw/Foo Bar/];
    package MyApp;
    __PACKAGE__->config->{'Model::Foo'}{traits} = [qw/-Foo Baz/];

Will load the traits:

    Bar Baz

Contributors

Tomas Doran, "<[email protected]>"

Acknowledgements

Matt S. Trout and Tomas Doran helped me with the current design.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 4 times.

  1. 6.0
  2. 7
  3. 8–10
  4. 11
  5. 12–13

Author

Rafael Kitover, "<[email protected]>"

Bugs

Please report any bugs or feature requests to "bug-catalystx-component-traits at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-Component-Traits>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

From libcatalystx-component-traits-perl 0.19-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.