I created a “bundle” module that does a bunch of things: import Moose , import true , namespace::autoclean , makes the caller class immutable (taken from MooseX::AutoImmute ). The only thing I could not figure out was to enable MooseX::Method::Signatures .
Here is what I have 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 now I still need to add an additional use MooseX::Method::Signatures; . How to include this in my OO module?
source share