On Fri, Feb 24, 2012 at 6:28 AM, Bill Moseley <mose...@hank.org> wrote: > Could someone please explain what's happening here? > > $ perl -MThrowable::Error -le 'package Foo; use Moose; extends > "Throwable::Error"; Foo->meta->make_immutable' > Not inlining 'new' for Foo since it has method modifiers which would be > lost if it were inlined > > I see that not calling make_immutable avoids the warning, but I'm not > understanding why.
The answer is in the error message. Something in the constructor for Foo is wrapping 'new' in a method modifier and if you were to inline that it would get lost. Since *you* aren't doing it, the answer lies somewhere else. Throwable::Error is your parent class, so it's safe to assume we're using it's new ... and Throwable::Error explicitly passes inline_constructor => 1 to make_immutable to stop inlining the constructor. So a bit more digging into the two roles that Throwable::Error composes leads to: https://metacpan.org/source/RJBS/Throwable-0.102080/lib/StackTrace/Auto.pm#L71 In which we find 'around new => { ... }'. Which is exactly the method modifier that Moose is warning about. -Chris