Perl::C...leWiths(3)
π Perl::Critic::Policy::Moose::ProhibitMultipleWiths π
okay bestie, so this page is all about Perl::Critic::Policy::Moose::ProhibitMultipleWiths (the man page header calls it Perl::C...leWiths(3) but that's just the terminal being β¨ dramatic β¨ with the truncation) β and it's giving Require role composition. π
β¨ VERSION β¨
version 1.05 β yeah, she's been around a minute and she still slays. π
πΈ DESCRIPTION πΈ
So, Moose::Roles? They're lowkey the answer to all those name conflicts that plague multiple inheritance and mix-ins. iconic behaviour, honestly. But here's the catch, bestie: to actually enjoy that protection, you have to compose your roles together. π
Roles do not generate conflicts if they're consumed individually. Which is exactly the problem β no conflict warning, no nothing, just vibes and chaos. π
So the move? Pass all your roles to a single with statement. That's it, that's the whole assignment. π«Ά
# ok
package Foo;
use Moose::Role;
with qw< Bar Baz >;
# not ok
package Foo;
use Moose::Role;
with 'Bar';
with 'Baz';
See how the second one is doing way too much with two separate with calls? Yeah. Not it. π
π¦ AFFILIATION π¦
This policy is part of Perl::Critic::Moose. She has a family, she's not out here alone. π
β CONFIGURATION β
There is a single option, "equivalent_modules". π
This lets you specify modules that should be treated the same as Moose and Moose::Role, if β say β you were doing something with Moose::Exporter. Custom Moose-ish energy, we love to see it. π
For example, if you were to have this in your .perlcriticrc file:
[Moose::ProhibitMultipleWiths]
equivalent_modules = MyCompany::Moose MooseX::NewThing
then the following code would result in a violation:
package Baz;
use MyCompany::Moose;
with 'Bing';
with 'Bong';
caught in 4K, no cap. that's a violation. π¨
π SUPPORT π
Bugs may be submitted through the RT bug tracker <http://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-Moose> (or bug-perl-critic-moose@rt.cpan.org <mailto:bug-perl-critic-moose@rt.cpan.org>).
I am also usually active on IRC as 'drolsky' on "irc://irc.perl.org". so like, come say hi, fr fr. π«Ά
π AUTHORS π
- Elliot Shank
<perl@galumph.com> - Dave Rolsky
<autarch@urth.org>
legends, both of them. periodt. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2008 - 2016 by Elliot Shank.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie! π¦ this gem comes to you from User Contributed Perl Documentation, running on perl v5.42.0, dated 2025-07-25, and the man page signs off as Perl::C...leWiths(3). mwah π go compose those roles together, ily, bye! β¨π
π¦ where this page comes from
- fedora 43: perl-Perl-Critic-Moose 1.05-27.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms