1Perl::Critic::Policy::MUosoesrPee:Cr:olPn:rt:orChiribibutititecMd:u:lPPteoirlplilceDyWo:ic:tuMhmoseo(ns3te)a:t:iPornohibitMultipleWiths(3)
2
3
4
6 Perl::Critic::Policy::Moose::ProhibitMultipleWiths - Require role
7 composition
8
10 version 1.05
11
13 Moose::Roles are, among other things, the answer to name conflicts
14 plaguing multiple inheritance and mix-ins. However, to enjoy this
15 protection, you must compose your roles together. Roles do not generate
16 conflicts if they are consumed individually.
17
18 Pass all of your roles to a single with statement.
19
20 # ok
21 package Foo;
22
23 use Moose::Role;
24
25 with qw< Bar Baz >;
26
27 # not ok
28 package Foo;
29
30 use Moose::Role;
31
32 with 'Bar';
33 with 'Baz';
34
36 This policy is part of Perl::Critic::Moose.
37
39 There is a single option, "equivalent_modules". This allows you to
40 specify modules that should be treated the same as Moose and
41 Moose::Role, if, say, you were doing something with Moose::Exporter.
42 For example, if you were to have this in your .perlcriticrc file:
43
44 [Moose::ProhibitMultipleWiths]
45 equivalent_modules = MyCompany::Moose MooseX::NewThing
46
47 then the following code would result in a violation:
48
49 package Baz;
50
51 use MyCompany::Moose;
52
53 with 'Bing';
54 with 'Bong';
55
57 Bugs may be submitted through the RT bug tracker
58 <http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-Moose>
59 (or bug-perl-critic-moose@rt.cpan.org <mailto:bug-perl-critic-
60 moose@rt.cpan.org>).
61
62 I am also usually active on IRC as 'drolsky' on "irc://irc.perl.org".
63
65 · Elliot Shank <perl@galumph.com>
66
67 · Dave Rolsky <autarch@urth.org>
68
70 This software is copyright (c) 2008 - 2016 by Elliot Shank.
71
72 This is free software; you can redistribute it and/or modify it under
73 the same terms as the Perl 5 programming language system itself.
74
75
76
77perl v5.30.0 Perl::Cri2t0i1c9:-:0P7o-l2i6cy::Moose::ProhibitMultipleWiths(3)