Re: Operator overloading in Moose
[email protected] (Chris Weyl) Sat, 15 Jun 2013 12:01:34 -0700 (PDT)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <alpine.DEB.2.02.1306151155020.4496@athena> |
On Sat, 15 Jun 2013, Faelin McCaley Landy wrote:
> Hi there,
>
> More questions! I'm trying to implement both increment/decrement
> operators and equality operators in Moose (using "++" / "--" and "=="),
> but my objects don't seem to respond at all to the use overload '==',
> ... pragma, or either of the other two relevant ones.
If you're using namespace::autoclean, your overloads will be removed from
the package, leaving things the way you describe them.
Unfortunately, there was a decision several years ago to not fix[1]
namespace::autoclean so as to enable it to play nice with overloading, so
take a look at MooseX::MarkAsMethods (and -autoclean => 1) if this is
indeed what's happening.
-Chris
[1] For admittedly reader-dependent values of "fix".