+ - Fix nonMoo constructor firing through multiple layers of Moo
- Fix bug where nonMoo is mistakenly detected given a Moo superclass
with no attributes (and hence no own constructor)
$moo_constructor = 1; # no other constructor, make a Moo one
}
};
- require Moo::_mro unless $moo_constructor;
Method::Generate::Constructor
->new(
package => $target,
require Method::Generate::Accessor;
Method::Generate::Accessor->new;
},
- ($moo_constructor ? ()
- : (construction_string => '$class->next::method(@_)'))
+ construction_string => (
+ $moo_constructor
+ ? ($con ? $con->construction_string : undef)
+ : ('$class->'.$target.'::SUPER::new(@_)')
+ )
)
->install_delayed
->register_attribute_specs(%{$con?$con->all_attribute_specs:{}})
use Moo;
extends 't::moo::extends_non_moo::middle';
has 'attr' => (is=>'ro');
+
+ package t::moo::extends_non_moo::second_level_moo;
+ use Moo;
+ extends 't::moo::extends_non_moo::moo_with_attr';
+ has 'attr2' => (is=>'ro');
}
ok my $app = 100,
is $app, 100,
'$app still 100';
+ok $app = t::moo::extends_non_moo::second_level_moo->wrap($app),
+ '$app from $app';
+
+is $app, 100,
+ '$app still 100';
+
done_testing();