I've made a "bundle" module which does a bunch of things: imports Moose
, imports true
, namespace::autoclean
, makes the caller's class immutable (taken from MooseX::AutoImmute
). The one thing I haven't been able to figure out is how to include MooseX::Method::Signatures
.
Here's what I've got so far:
package My::OO;
use Moose::Exporter;
use Hook::AfterRuntime;
use Moose ();
use true ();
use namespace::autoclean ();
my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods(
also => ['Moose'],
);
sub import {
true->import();
my $caller = scalar caller;
after_runtime { $caller->meta->make_immutable };
namespace::autoclean->import(-cleanee => $caller);
goto &$import;
}
sub unimport {
goto &$unimport;
}
1;
The idea is that in my code, I can now do things like this:
package My::Class; {
use My::OO;
extends 'My::Parent';
method foo() { ... }
}
but right now I still have to include an extra use MooseX::Method::Signatures;
. How can I include that into my OO module?