Subject: | Extends broken for multiple levels of inheritence |
Assuming the following model (where -> means extends):
Four -> Three -> Two -> One ( -> implicit Coat::Object extends here)
When attempt to assert for default values declared in One via Four we
get an undef returned. Looking at the Coat::Meta object during a debug
session it looks as if Coat believes the inheritance is:
Four -> Three -> Two -> Coat::Object
Without understanding the method of inheritance more it seems as if it
is Coat::Meta::extends which is at fault or the other parts of the
extension tree needs to be added to the $CLASSES->{'@!family'}{$class}
hash.
Subject: | assert_extends.pl |
{
package One;
use Coat;
has 'one' => (isa => 'Int', is => 'rw', default => 1);
package Two;
use Coat;
extends 'One';
has 'two' => (isa => 'Int', is => 'rw', default => 2);
package Three;
use Coat;
extends 'Two';
has 'three' => (isa => 'Int', is => 'rw', default => 3);
package Four;
use Coat;
extends 'Three';
has 'four' => (isa => 'Int', is => 'rw', default => 4);
}
use Test::More tests => 4;
my $m = Four->new;
is($m->four, 4, 'Level 4 return 4');
is($m->three, 3, 'Level 3 return 3');
is($m->two, 2, 'Level 2 return 2');
is($m->one, 1, 'Level 1 return 1');