我想使用 Moo 而不是 Moose,但我还需要从非 Moose 类继承。我应该如何处理?有没有一个模块可以解决这个问题?如果没有,有没有办法我自己处理?
最佳答案
Moo 已经可以处理子类化非 Moo/Moose 类。你不需要扩展。
请参阅 FOREIGNBUILDARGS 的文档,其中指出:
If you are inheriting from a non-Moo class, the arguments passed to the parent class constructor can be manipulated by defining a FOREIGNBUILDARGS method. It will receive the same arguments as BUILDARGS, and should return a list of arguments to pass to the parent class constructor.
关于perl - Moo 的 MooseX::NonMoose 等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27544191/