xslate / p5-Mouse

Lightweight class builder for Perl, as a subset of Moose
https://metacpan.org/release/Mouse
Other
46 stars 32 forks source link

Don't use methods which conflicted #13

Closed hiratara closed 10 years ago

hiratara commented 10 years ago

Hi.

I found that Moose passed role_conflict_and_inheritance.t but Mouse didn't. Conflicting methods should be considered as a required one.

tokuhirom commented 10 years ago

Is it breaks the existent code?

gfx commented 10 years ago

@hiratara Can you add warnings for cases where existing code breaks?

hiratara commented 10 years ago

This change may break old codes if your codes depend on this incorrect behavior.

I can output following message when this change actually occurs, but it looks a bit redundant.

Due to a method name conflict in roles 'Role::Foo1' and 'Role::Foo2', the behavior of method 'foo' might be changed in Mouse-1.14, check it out at /tmp/p5-Mouse/blib/lib/Mouse/Meta/Role/Composite.pm line 162.
        Mouse::Meta::Role::Application::RoleSummation::apply_methods('Mouse::Meta::Role::Application::RoleSummation=HASH(0x2a4c0c8)', 'Mouse::Meta::Role::Composite=HASH(0x2817ed8)', 'Mouse::Meta::Class=HASH(0x2a45ba8)') called at /tmp/p5-Mouse/blib/lib/Mouse/Meta/Role/Application.pm line 71
        Mouse::Meta::Role::Application::apply('Mouse::Meta::Role::Application::RoleSummation=HASH(0x2a4c0c8)', 'Mouse::Meta::Role::Composite=HASH(0x2817ed8)', 'Mouse::Meta::Class=HASH(0x2a45ba8)') called at /tmp/p5-Mouse/blib/lib/Mouse/Meta/Role/Composite.pm line 107
        Mouse::Meta::Role::Composite::apply('Mouse::Meta::Role::Composite=HASH(0x2817ed8)', 'Mouse::Meta::Class=HASH(0x2a45ba8)') called at /tmp/p5-Mouse/blib/lib/Mouse/Util.pm line 333
        Mouse::Util::apply_all_roles('BarSub', 'Role::Foo1', 'Role::Foo2') called at /tmp/p5-Mouse/blib/lib/Mouse.pm line 40
        Mouse::with('Role::Foo1', 'Role::Foo2') called at t/030_roles/role_conflict_and_inheritance.t line 21
hiratara commented 10 years ago

I'm sorry but I found better implementation and I used "git push -f" to hide old changes.

My old patch is here. https://github.com/hiratara/p5-Mouse/commit/cd097c2a85e8e39f11a9b112bf13a3e19522da82

gfx commented 10 years ago

LGTM! Thanks.