On Mar 19, 2010, at 5:01 PM, Robin Smidsrød wrote:

> On 19.03.2010 19:38, Jesse Luehrs wrote:
>> On Fri, Mar 19, 2010 at 06:32:36PM +0000, Ævar Arnfjörð Bjarmason wrote:
>>> On Fri, Mar 19, 2010 at 18:28, Jesse Luehrs <[email protected]> wrote:
>>>> Um... did you actually try to run this code? Because it already does
>>>> exactly what you are trying to do.
>>> 
>>> Actually it doesn't.
>>> 
>>> I'm guessing that the problem here is that he's calling A->extends()
>>> in the B package instead of extends("A");
>> 
>> Which causes perl to die with a recursive inheritance error (since
>> A->extends() is equivalent to A::extends('A')), so I'm assuming that his
>> actual code isn't doing that.
> 
> I assume that the solution is to change A into this:
> 
> package A;
> use Moose;
> no Moose; # <-- Added this
> 1;
> 
> With that in place the call to A->extends() would fail with an invalid
> method call during runtime.
> 
> But 'no Moose' isn't mandatory, as far as I know, which means that his
> example seems to be a good test case for a really obscure edge case.
> 
> -- Robin

The Moose docs implicitly state that extends() should be called using the class 
as a string and not as a symbol (the latter which triggers the indirect object 
call):

extends 'Point';

Maybe the docs need to be updated to state that explicitly (and indicate why)?

chris

Reply via email to