Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个需要在构造函数周围添加包装器的 MooX 模块。
我试过方法修改或直接改变导入方法*{"${target}::new"}没有效果。
*{"${target}::new"}
那么我该怎么做呢?
显然, around 确实有效:
package MyRole; use Moo::Role around new => sub { ... };
但是有环绕的角色需要在添加属性后才消耗掉,例如
package MyClass; use Moo; has attr1 => (... ); with 'MyRole';