Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 44895
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: ovid [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.64
  • 0.65
  • 0.66
  • 0.67
  • 0.68
  • 0.69
  • 0.70
  • 0.71
  • 0.71_01
  • 0.72
  • 0.72_01
  • 0.73
  • 0.74
Fixed in: (no value)



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
Hey Ovid, I just spent a large part of today refactoring the required- method handling of roles to solve this problem. We've had a number of users report that the error was confusing and today's report was the straw that broke the camel's back. The error message for your test case has become: Due to a method name conflict in roles 'Role1' and 'Role2', the method 'foo' must be implemented by 'Conflicts' In particular I'm pretty proud of this diff hunk: http://github.com/nothingmuch/moose/ commit/79886df7fe307692f03338b0ba21506e7471f28d#L4L105 Since I did this work on a branch, I'll wait until the code is vetted and released before I resolve the ticket. Shawn
Subject: Re: [rt.cpan.org #44895] Bad Error Message With Role Conflicts
Date: Mon, 1 Jun 2009 02:52:36 -0700 (PDT)
To: bug-Moose [...] rt.cpan.org
From: Ovid <curtis_ovid_poe [...] yahoo.com>
Show quoted text
----- Original Message ----
> From: Shawn M Moore via RT <bug-Moose@rt.cpan.org> > > I just spent a large part of today refactoring the required- > method handling of roles to solve this problem. We've had a > number of users report that the error was confusing and > today's report was the straw that broke the camel's back. > > The error message for your test case has become: > > Due to a method name conflict in roles 'Role1' and 'Role2', > the method 'foo' must be implemented by 'Conflicts' > > In particular I'm pretty proud of this diff hunk: > > http://github.com/nothingmuch/moose/ > commit/79886df7fe307692f03338b0ba21506e7471f28d#L4L105
Hi Shawn, The error message does look much better. One question, though. Since the Conflicts class needs to resolve the conflict and not necessarily implement the method, is the error message a touch misleading? Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://use.perl.org/~Ovid/journal/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
On Mon Jun 01 05:52:53 2009, curtis_ovid_poe@yahoo.com wrote: Show quoted text
> The error message does look much better. One question,
though. Since Show quoted text
> the Conflicts class needs to resolve the conflict and not
necessarily Show quoted text
> implement the method, is the error message a touch
misleading? Good point, I've amended the message to say "the method 'foo' must be implemented or excluded by 'class'". Thanks! I could've copped out and just said "resolved by 'class'" but that wouldn't help as much in letting the user figure out what the next step is. Since the people who have looked at the code approve, I'm certain it'll make it into the next release, so I'm resolving this. :) Shawn