我做了一个“捆绑”模块,它做了很多事情:导入Moose,导入true,namespace :: autoclean,使调用者的类不可变(取自MooseX :: AutoImmute).我无法弄清楚的一件事是如何包含MooseX :: Method :: Signatures.
这是我到目前为止所得到的:
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;
我的想法是,在我的代码中,我现在可以做这样的事情:
package My::Class; { use My::OO; extends 'My::Parent'; method foo() { ... } }
但是现在我仍然需要额外使用MooseX :: Method :: Signatures;.如何将其包含在我的OO模块中?