perl - Moo 的 MooseX::NonMoose 等价物是什么?

标签 perl oop

我想使用 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/

相关文章:

performance - 为什么 perl 比 d 语言快?

c# - ValidationRule 的执行集-C# 类设计 - 更好的方法

php - 面向对象设计 : Is it good to restrict I/O parameters?

perl - DBD::SQLite:数据库被锁定:如何重试?

perl - 在退出之前终止 Perl 中的子进程的正确方法是什么?

perl - 如何使用 PDF::API2::Lite 添加带有图像的页眉、页脚?

c - 是否有可以同时处理 C 和 Perl 的 Windows IDE?

delphi - InstanceClass.NewInstance 与 InstanceClass.Create

javascript - 为什么我的方法没有返回对象

javascript - 将类放入单独的文件中时出现 Typescript 错误