加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl – 为什么“使用namespace :: autoclean”优先于“no Moose

发布时间:2020-12-15 21:14:49 所属栏目:大数据 来源:网络整理
导读:关于Moose的最佳做法的经常看到的建议如下: “The use namespace::autoclean bit is simply good code hygiene,as it removes imported symbols from your class’s namespace at the end of your package’s compile cycle,including Moose keywords. Once
关于Moose的最佳做法的经常看到的建议如下:

“The use namespace::autoclean bit is simply good code hygiene,as it removes imported symbols from your class’s namespace at the end of your package’s compile cycle,including Moose keywords. Once the class has been built,these keywords are not needed. (This is preferred to placing no Moose at the end of your package).”

以Moose::Manual::BestPractices(重点为我).

我理解上述引用的一切,除了一件事情:为什么使用namespace :: autoclean比较适合在词法范围的末尾使用Moose?

它只是因为namespace :: autoclean是更多功能,允许更多的选择在其使用,或者有什么内在的方式实现(特别为Moose课程量身定做,这可以使它更可靠?

我发现没有文件澄清这一点,我很想知道正确的答案.

解决方法

没有麋鹿只摆脱通过使用Moose导入的功能.使用namespace :: autoclean可以摆脱所有导入的函数.

如果你总是使用namespace :: autoclean,那么如果你稍后回来并从某个模块导入一个函数,那么你不需要记住不要使用Moose来使用namespace :: autoclean.否则,你可能会忘记这样做.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读