MooseX::RelatedClassRoles(3pm)

MooseX::RelatedClassRoles3pm

Apply roles to a class related to yours

Usage

    package My::Class;
    use Moose;
    has driver_class => (
      isa => 'MyApp::Driver',
    );
    with 'MooseX::RelatedClassRoles' => { name => 'driver' };
    # ...
    my $obj = My::Class->new(driver_class => "Some::Driver");
    $obj->apply_driver_class_roles("Other::Driver::Role");

Version

version 0.004

Overview

Frequently, you have to use a class that provides some "foo_class" accessor or attribute as a method of dependency injection. Use this role when you'd rather apply roles to make your custom "foo_class" instead of manually setting up a subclass.

Parameters

name

A string naming the related class. "driver" in the "SYNOPSIS". Required.

class_accessor_name

A string naming the related class accessor. "driver_class" in the "SYNOPSIS". Defaults to appending "_class" to the "name".

apply_method_name

A string naming the role applying method. "apply_driver_class_names" in the "SYNOPSIS". Defaults to adding "apply_" and "_names" to the "class_accessor_name".

Blame

    Florian Ragwitz (rafl)

Releases

7 releases since Debian 7 (Wheezy); the text changed 1 time.

  1. 7–10
  2. 11–13

Author

  Hans Dieter Pearcey <[email protected]>

From libmoosex-relatedclassroles-perl 0.004-1.1 in Debian 13 (Trixie). Parsed by carta from the page's man source.