Hey, I've got another branch ready for review. This one makes
Moose::Exporter optionally generate an init_meta method for you, along
with import and unimport. This should make extension writing much
cleaner - what used to look like this:
package My::Exporter;
use Moose::Exporter;
use Moose::Util::MetaRole;
Moose::Exporter->setup_import_methods;
sub init_meta {
shift;
my %options = @_;
Moose::Util::MetaRole::apply_metaclass_roles(
for_class => $options{for_class},
metaclass_roles => ['My::Meta::Trait::Class'],
);
Moose::Util::MetaRole::apply_base_class_roles(
for_class => $options{for_class},
roles => ['My::Role::Object'],
);
return Class::MOP::class_of($options{for_class});
}
now looks like this:
package My::Exporter;
use Moose::Exporter;
Moose::Exporter->setup_import_methods(
metaclass_roles => ['My::Meta::Trait::Class'],
base_class_roles => ['My::Role::Object'],
);
There was also another change to Moose::Exporter to make this easier to
deal with - build_import_methods takes an optional parameter of
'install', which is an arrayref of which of 'import', 'unimport', and
'init_meta' to install (so setup_import_methods is just a wrapper around
build_import_methods(install => [qw(import unimport init_meta)])).
Thanks,
-doy