On Sep 1, 2009, at 11:11 PM, Jesse Luehrs wrote:
On Tue, Sep 01, 2009 at 10:58:58PM -0500, Chris Fields wrote:
All,
Not sure if this is addressed in some way with the merge of MXAH to
core, but I ran into a small issue with roles and aliasing
methods. Not
sure if I'm approaching this right though, so please let me know if
I'm
not. I already have the workaround (e.g. explicitly define the
methods in
the role, don't use 'provides'). This was using Moose 0.89 on OS X
10.6
(works great on Snow Leopard BTW).
This doesn't actually have anything to do with MX-AttributeHelpers,
the
same thing happens if you just try to alias the normal accessor. The
issue is that attributes in roles aren't real attributes at the
moment,
and in particular, the attribute accessors aren't generated until the
attribute is composed into an actual class, which happens after the
processing for 'alias' and 'excludes' takes place. This is something
that's intended to be fixed in the future, but it's going to take a
bit
of effort to get done. In the meantime, you might want to check out
MooseX::Aliases, which would let you do something like
"alias add_stuff => 'add_my_stuff'" rather than relying on the role
composition aliasing features.
-doy
That's what I thought. I do recall running into this as well with the
normal accessor as you indicated and thought they might be related,
just hadn't dived into Moose guts enough to work it out for myself.
BTW, I'm actually using MooseX::Aliases now for another purpose;
thanks for that one! I'll go ahead and use that.
Also (and apologetically unrelated to the above), any idea if/when
MooseX::Aliases would (as the MX::Aliases docs state) subsume
MX::MultiInitArgs? I have considered playing around with merging the
two and submitting a patch, just haven't had time to devote to it yet...
chris