简体   繁体   English

什么是Moo的MooseX :: NonMoose?

[英]What is an equivalent of MooseX::NonMoose for Moo?

I would like to use Moo instead of Moose, but I also need to inherit from non-Moose classes. 我想使用Moo而不是Moose,但我还需要继承非Moose类。 How should I deal with that? 我应该怎么处理? Is there a module to work around this? 有一个模块可以解决这个问题吗? If not, is there a way I can handle it myself? 如果没有,我有办法自己处理吗?

Moo can handle subclassing non-Moo/Moose classes already. Moo已经可以处理子类非Moo / Moose类。 You don't need an extension. 您不需要扩展名。

See the documentation for FOREIGNBUILDARGS , which states: 请参阅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. 如果从非Moo类继承,则可以通过定义FOREIGNBUILDARGS方法来操作传递给父类构造函数的参数。 It will receive the same arguments as BUILDARGS, and should return a list of arguments to pass to the parent class constructor. 它将接收与BUILDARGS相同的参数,并应返回传递给父类构造函数的参数列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM