1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
  
     | 
    
      use strict;
use warnings;
use Test::More;
{
  package MyClassRoot;
  use Moo;
  has root => (is => 'ro');
}
{
  package MyClassLeft;
  use Moo;
  extends 'MyClassRoot';
  has left => (is => 'ro');
}
{
  package MyClassRight;
  use Moo;
  extends 'MyClassRoot';
  has right => (is => 'ro');
}
{
  package MyClassChild;
  use Moo;
  extends 'MyClassLeft', 'MyClassRight';
  has child => (is => 'ro');
}
my $o = MyClassChild->new(root => 1, left => 2, right => 3, child => 4);
is $o->root, 1, 'constructor populates root class attribute';
is $o->left, 2, 'constructor populates left parent attribute';
is $o->right, undef, 'constructor doesn\'t populate right parent attribute';
is $o->child, 4, 'constructor populates child class attribute';
done_testing;
 
     |