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

Comments

Projects
None yet
2 participants
@rsimoes

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

This comment has been minimized.

Show comment
Hide comment
@barefootcoder

barefootcoder Sep 26, 2011

Contributor

I'll be looking into this today.

Contributor

barefootcoder commented Sep 26, 2011

I'll be looking into this today.

@barefootcoder

This comment has been minimized.

Show comment
Hide comment
@barefootcoder

barefootcoder Sep 27, 2011

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.

Contributor

barefootcoder commented Sep 27, 2011

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

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
@barefootcoder

This comment has been minimized.

Show comment
Hide comment
@barefootcoder

barefootcoder Sep 27, 2011

Contributor

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

Contributor

barefootcoder commented Sep 27, 2011

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

@barefootcoder

This comment has been minimized.

Show comment
Hide comment
@barefootcoder

barefootcoder Sep 28, 2011

Contributor

Dev release that fixes this issue is up now.

Contributor

barefootcoder commented Sep 28, 2011

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