本文介绍了在Perl中从Moose迁移到鼠标-鼠标未执行BUILD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于速度考虑,我正在尝试从Moose迁移到Mouse,但是遇到了showtopper错误.

I'm trying to migrate from Moose to Mouse in the interests of speed but have encountered a showstopper error.

我正在同一范围内构建两个对象:

I'm building two objects in the same scope:

sub scope {

   my $foo = Foo->new();
   my $bar = Bar->new();

}

Foo的BUILD方法正在触发,而Bar的BUILD方法没有触发.有任何想法吗? Foo和Bar都从Baz继承,而Baz则从Mouse :: Object继承.

The BUILD method of Foo is firing but the BUILD method of Bar is not. Any ideas? Both Foo and Bar inherit from Baz which inherits from Mouse::Object.

推荐答案

您并未真正为任何人提供足够的上下文来调试它.

You're not really providing enough context for anybody to debug this.

我也担心您的评论为了速度"从Moose迁移到Mouse而没有更好的选择.那里有几个软件包可以比Mouse或Moose更快地进行基准测试.对您的应用程序进行性能分析可能表明您花费了99%的时间在元类编译,访问器访问和对象创建上……这时移植到Mouse可能是合理的.事实证明,您将99%的时间花在业务逻辑上,此时移植到Mouse不会为您做任何事情.

Also I'm worried about your comment migrating from Moose to Mouse "in the interests of speed" without having a better. There are several packages out there that benchmark faster than either Mouse or Moose for speed. Profiling your application may show that you spend 99% of your time in metaclass compliation, accessor access, and object creation ... at which point porting to Mouse might be justified. It may turn out that you spend 99% of your time in business logic at which point porting to Mouse won't do anything for you.

鼠标非常好,并且有几个特定的​​用例.当我知道我将在Moose传统上不擅长(CGI)的环境中运行时,我已经在生产中使用了它.但是,Mouse不是(就像某些人似乎声称的那样)Moose + FAST ... Mouse更是Moose-Class :: MOP(以及所有在MOP级别上使Perl标准化的技术).

Mouse is excellent, and has several specific use cases. I've used it in production when I knew I'd be running in an environment that Moose is traditionally poor at (CGI). However Mouse is not (as some people seem to claim) Moose + FAST ... Mouse is more Moose - Class::MOP (and all the hacks that have gone into normalizing Perl at the MOP level).

这篇关于在Perl中从Moose迁移到鼠标-鼠标未执行BUILD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 02:25