Hi all --
A while back I noticed that when I tried to use namespace::autoclean
and overload in the same package, my overloads would be purged by
namespace::autoclean... Resulting in a non-optimal situation.
Digging into it a bit more it became quickly apparent that this was
happening because overloads weren't being recognized as methods by
Class::MOP. I wrote a little hack that would "fix" this in
namespace::autoclean; it was pretty hackish, and ended up redoing it
(a little better, I hope) in MooseX::MarkAsMethods.
Sooo....
1) Am I crazy in thinking that overloads should be, if not treated as
methods, then at least tracked/managed by CMOP as methods (or
something similar)?
2) How does CMOP determine what is a method and what isn't?
I spent a little time the other day going through the CMOP source
trying to figure this out... It seems like it happens in
CMOP::Package, with the XS magic in HasMethods.xs... Right? My
XS-foo isn't amazing right now, so it seemed better to ask :) I also
dug through MooseX::Role::WithOverloading, as it seemed like this
should be able point me in the right direction; it simply copies
package symbols over from the role to the class/role being composed.
...which lead me to realize that MX:RWO doesn't address the underlying
issue: roles created with it also have their overloads stripped if one
uses namespace::autoclean in the role. MX::RWO only works as the
"with" pulls the overload symbols in after namespace::autoclean has
done its thing.
I'm certainly willing to try my hand at a topic branch if #1 makes
sense, but it seemed like a good idea to ask for advice (and a sanity
check) here first :)
Thanks-
-Chris
--
Chris Weyl
Ex astris, scientia