return if $MAKERS{$target}; # already exported into this package
$MAKERS{$target} = {};
_install_tracked $target => extends => sub {
- _load_module($_) for @_;
- # Can't do *{...} = \@_ or 5.10.0's mro.pm stops seeing @ISA
- @{*{_getglob("${target}::ISA")}{ARRAY}} = @_;
- if (my $old = delete $Moo::MAKERS{$target}{constructor}) {
- delete _getstash($target)->{new};
- Moo->_constructor_maker_for($target)
- ->register_attribute_specs(%{$old->all_attribute_specs});
- }
- no warnings 'once'; # piss off. -- mst
- $Moo::HandleMoose::MOUSE{$target} = [
- grep defined, map Mouse::Util::find_meta($_), @_
- ] if $INC{"Mouse.pm"};
+ $class->_set_superclasses($target, @_);
$class->_maybe_reset_handlemoose($target);
return;
};
_unimport_coderefs($target, $MAKERS{$target});
}
+sub _set_superclasses {
+ my $class = shift;
+ my $target = shift;
+ _load_module($_) for @_;
+ # Can't do *{...} = \@_ or 5.10.0's mro.pm stops seeing @ISA
+ @{*{_getglob("${target}::ISA")}{ARRAY}} = @_;
+ if (my $old = delete $Moo::MAKERS{$target}{constructor}) {
+ delete _getstash($target)->{new};
+ Moo->_constructor_maker_for($target)
+ ->register_attribute_specs(%{$old->all_attribute_specs});
+ }
+ no warnings 'once'; # piss off. -- mst
+ $Moo::HandleMoose::MOUSE{$target} = [
+ grep defined, map Mouse::Util::find_meta($_), @_
+ ] if $INC{"Mouse.pm"};
+}
+
sub _maybe_reset_handlemoose {
my ($class, $target) = @_;
if ($INC{"Moo/HandleMoose.pm"}) {