The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CatalystX::ComponentsFromConfig::Role::AdaptorRole - parameterised role for trait-aware component adaptors

VERSION

version 0.1_03

DESCRIPTION

Here we document implementation details, see CatalystX::ComponentsFromConfig::ModelAdaptor and CatalystX::ComponentsFromConfig::ViewAdaptor for usage examples.

This role uses MooseX::Traits::Pluggable to allow you to add roles to your model classes via the configuration.

ATTRIBUTES

class

The name of the class to adapt.

args

Hashref to pass to the constructor of the adapted class.

traits

Arrayref of traits / roles to apply to the class we're adapting. These will be processed by _build_instance_with_traits in MooseX::Traits::Pluggable (like new_with_traits, see also MooseX::Traits).

METHODS

_trait_namespace

Used by MooseX::Traits::Pluggable. Given a "class" of My::App::Special::Class::For::Things loaded into the My::App Catalyst application, the following namespaces will be searched for traits / roles:

  • My::App::TraitFor::Special::Class::For::Things

  • My::App::TraitFor::Class::For::Things

  • My::App::TraitFor::For::Things

  • My::App::TraitFor::Things

  • My::App::TraitFor::${component_type}::Things

On the other hand, if the class name does not start with the application name, just ${class}::TraitFor will be searched.

ROLE PARAMETERS

component_type

One of 'model', 'view', 'controller'. There is no pre-packaged aadptor to create controllers, mostly because I could not think of a sensible way to write it.

AUTHORS

  • Tomas Doran (t0m) <bobtfish@bobtfish.net>

  • Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Net-a-porter.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.