1MooseX::RelatedClassRolUesse(r3)Contributed Perl DocumenMtoaotsieoXn::RelatedClassRoles(3)
2
3
4

NAME

6       MooseX::RelatedClassRoles - Apply roles to a class related to yours
7

VERSION

9       version 0.004
10

SYNOPSIS

12           package My::Class;
13           use Moose;
14
15           has driver_class => (
16             isa => 'MyApp::Driver',
17           );
18
19           with 'MooseX::RelatedClassRoles' => { name => 'driver' };
20
21           # ...
22
23           my $obj = My::Class->new(driver_class => "Some::Driver");
24           $obj->apply_driver_class_roles("Other::Driver::Role");
25

DESCRIPTION

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

PARAMETERS

33   name
34       A string naming the related class.  "driver" in the "SYNOPSIS".
35       Required.
36
37   class_accessor_name
38       A string naming the related class accessor.  "driver_class" in the
39       "SYNOPSIS".  Defaults to appending "_class" to the "name".
40
41   apply_method_name
42       A string naming the role applying method.  "apply_driver_class_names"
43       in the "SYNOPSIS".  Defaults to adding "apply_" and "_names" to the
44       "class_accessor_name".
45

BLAME

47           Florian Ragwitz (rafl)
48

AUTHOR

50         Hans Dieter Pearcey <hdp@cpan.org>
51
53       This software is copyright (c) 2009 by Hans Dieter Pearcey
54       <hdp@cpan.org>.
55
56       This is free software; you can redistribute it and/or modify it under
57       the same terms as perl itself.
58
59
60
61perl v5.34.0                      2022-01-21      MooseX::RelatedClassRoles(3)
Impressum