Trouble creating method modifiers for attribute accessors in Moose roles #36

rsimoes opened this Issue Sep 24, 2011 · 4 comments


None yet

2 participants

rsimoes commented Sep 24, 2011

The following dies with "cannot create after modifier in package Foo for non-existent method foo at...":

use MooseX::Declare;
use Method::Signatures::Modifiers;

role Foo {
    has foo => ( is => 'ro' );
    after foo { }

It works with MooseX::Method::Signatures.


I'll be looking into this today.


I see the problem: I'm trying to catch an error before Moose throws it, but determining that error for roles is practically impossible. I think the right approach is to not to try to catch this error at all; in this particular case, our error isn't particularly nicer than Moose's anyway. So I'll just take out my check and let Moose error out if it wants to, or not if it doesn't.

I'll work up some failing tests and a fix and commit that tonight or tomorrow at the latest.

@barefootcoder barefootcoder added a commit that referenced this issue Sep 27, 2011
@barefootcoder barefootcoder fix for Github issue #36
we were trying to catch the case where adding a method modifier for a non-existent method threw a Moose error
then we threw our own error
unfortnately, it's *okay* to add a method modifier for a non-existent method in a role (just not a class)
and, anyway, our error message wasn't that much cooler than Moose's
so just removing the custom error and letting Moose decided when to err out and when not to

This looks to be fixed. I'll try to get out a dev release with the fix by the end of the day.


Dev release that fixes this issue is up now.

@barefootcoder barefootcoder was unassigned by rsimoes Mar 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment