MooseX:...onflict(3)
π NAME π
okay bestie, so MooseX::Role::WarnOnConflict is the role thing that yells at you when a class stomps all over a role's methods without, like, officially saying it's excluding them. it's giving "hey. hey. i saw that." π«Ά
β¨ VERSION β¨
this is version 0.01 β babiest of versions, but she works π
πΈ SYNOPSIS πΈ
so this code right here? it will warn at composition time, no cap:
{
package My::Role;
use MooseX::Role::WarnOnConflict;
sub conflict {}
}
{
package My::Class;
use Moose;
with 'My::Role';
sub conflict {}
}
and the error message you get is like, similar to the following:
The class My::Class has implicitly overridden the method (conflict) from
role My::Role ...
π the class really said "i'm the main character now" and took over conflict.
to fix it, you gotta explicitly exclude that 'conflict' method β be upfront about it, bestie:
{
package My::Class;
use Moose;
with 'My::Role' => { -excludes => [ 'conflict' ] };
sub conflict {}
}
and heads up π¨ β aliasing a role method to a method that already exists will also warn. the vibes get messy:
{
package My::Class;
use Moose;
with 'My::Role' => {
-excludes => ['conflict'],
-alias => { conflict => 'another_method' },
};
sub conflict { }
sub another_method { }
}
π¦ DESCRIPTION π¦
so here's the tea, bestie. when you're using Moose::Role, a class that provides a method the role also provides will justβ¦ silently override it. no warning, no nothing. just silence π
and that silence is exactly the problem, because it can cause strange, hard-to-debug errors when the role's methods are not called. you'll be sitting there like "why isn't my method running?? who took it??" and the answer is: nobody told you. π
the fix is literally so easy it's iconic β just use "MooseX::Role::WarnOnConflict" instead of "Moose::Role", and overriding a role's method becomes a composition-time warning. no more mystery, no more detective work π΅οΈβοΈβ¨
and for how to actually resolve it? see the synopsis above, i got you. π
π AUTHOR π
Curtis "Ovid" Poe <curtis.poe@gmail.com> β king behavior, honestly π
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2022 by Curtis "Ovid" Poe.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
and that's the whole page, bestie!! this was written against perl v5.42.0 and stamped 2025-07-25 β so if you're reading this way later, just know she's been slaying since then πβ mwah π
π¦ where this page comes from
- fedora 43: perl-MooseX-Role-WarnOnConflict 0.01-11.fc43 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms