Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rsimoes opened this issue Sep 24, 2011 · 4 comments
Closed

Comments

@rsimoes
Copy link

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.

@ghost ghost assigned barefootcoder Sep 26, 2011
@barefootcoder
Copy link
Contributor

I'll be looking into this today.

@barefootcoder
Copy link
Contributor

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 added a commit that referenced this issue Sep 27, 2011
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
@barefootcoder
Copy link
Contributor

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

@barefootcoder
Copy link
Contributor

Dev release that fixes this issue is up now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants