both for the "original" class and anything it re-exports.
This means you can re-export Moose.pm without implementing an
init_meta.
}
);
- my $import = $class->_make_import_sub($exporter);
+ my $import = $class->_make_import_sub( $exporter, \@exports_from );
my $unimport = $class->_make_unimport_sub( [ keys %{$exports} ] );
}
sub _make_import_sub {
- my $class = shift;
- my $exporter = shift;
+ shift;
+ my $exporter = shift;
+ my $exports_from = shift;
return sub {
return;
}
- if ( $class->can('init_meta') ) {
- $class->init_meta(
- for_class => $CALLER,
- );
+ for my $c (grep { $_->can('init_meta') } $class, @{$exports_from} ) {
+
+ $c->init_meta( for_class => $CALLER );
}
goto $exporter;
ok( ! WantsMoose->can('has'), 'WantsMoose::has() has been cleaned' );
ok( ! WantsMoose->can('with'), 'WantsMoose::with() has been cleaned' );
can_ok( 'WantsMoose', 'foo' );
+
+ # This makes sure that Moose->init_meta() happens properly
+ isa_ok( WantsMoose->meta(), 'Moose::Meta::Class' );
+ isa_ok( WantsMoose->new(), 'Moose::Object' );
+
}
{