Subject: | Bad Error Message With Role Conflicts |
When more than one role provides the same method, the error message
provided is unclear. Given this code where both roles provide a 'foo'
method:
#!/usr/bin/env perl
use strict;
use warnings;
{
package Role1;
use Moose::Role;
sub foo {}
}
{
package Role2;
use Moose::Role;
sub foo {}
}
package Conflicts;
use Moose;
with qw(Role1 Role2);
The error messsage is:
'Role1|Role2' requires the method 'foo' to be
implemented by 'Conflicts' at /home/poec01/branches
/refactor_dbic_layer/deps/lib/perl5/Moose/Meta/Role
/Application.pm line 59
I find that confusing because the foo method *was* implemented. In our
actual codebase, I had to dig through quite a bit of to realize what
that we had two roles providing the same method.
I would prefer to see an error message stating which roles have a method
in conflict.
Cheers,
Ovid