- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的last question @Borodin 评论了我的问题:
You should start by removing Modern::Perl and namespace::sweep. Modules that behave as pragma should be avoided.
我有点困惑,因为:
namespace::autoclean
。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).
Intermediate perl
书中也推荐使用 namespace::autoclean
。
是的,我用 sweep
模块代替了 autoclean
- 因为再次 from the doccu
This pragma was written to address some problems with the excellent namespace::autoclean. In particular, namespace::autoclean will remove special symbols that are installed by overload, so you can't use namespace::autoclean on objects that overload Perl operators.
... ...
In most cases, namespace::sweep should work as a drop-in replacement for namespace::autoclean. Upon release, this pragma passes all of namespace::autoclean's tests, in addition to its own.
而且因为我是 perl 初学者,我真的很困惑。对我来说,当我阅读:这个模块解决了另一个模块的一些问题 - 意思是:使用这个。
'手册(我应该从哪里学习)说“使用它”和来自 stackoverflow teling 的专家:不要使用它。
所以请有人解释一下:
namespace::sweep
是正确的,或者我应该使用 namespace::autoclean
还是不使用它们?对于“ModernPerl”。当然,我可能并不深入和“确切地”理解它的作用。我所知道的,(再次来自它的 doccu)
This enables the strict and warnings pragmas, as well as all of the features available in Perl 5.10. It also enables C3 method resolution order as documented in perldoc mro and loads IO::File and IO::Handle so that you may call methods on filehandles. In the future, it may include additional core modules and pragmas.
当然,对mro
理解不深,只认为是多继承情况下“致命钻石”问题的解答。
直到今天,我都对它感到非常满意,因为它缩短了我所需的 pragma:
use strict;
use warnings;
use feature 'say';
那么,“Modern::Perl”(以及其他类似的 cpanm 模块)的“状态”是什么?是否允许使用?
最佳答案
关于命名空间::sweep 的问题:
首先,注意 namespace::sweep 解决的实际问题。
In particular, namespace::autoclean will remove special symbols that are installed by overload, so you can't use namespace::autoclean on objects that overload Perl operators.
这意味着如果你的类有重载的运算符,如果你也使用 namespace::autoclean
,它们将无法工作。但是这个问题只有在你使用重载
时才会出现。除此之外,namespace::autoclean 就足够了。
其次,它说可以使用 namespace::sweep 代替 namespace::autoclean:
In most cases, namespace::sweep should work as a drop-in replacement for namespace::autoclean. Upon release, this pragma passes all of namespace::autoclean's tests, in addition to its own.
所以要回答您的问题,“使用 namespace::sweep 是否正确,或者我应该使用 namespace::autoclean 还是不使用它们?”
使用重载
,那么使用 namespace::autoclean 就没有问题,所以你可以在这种情况下使用它。关于perl - 使用或不使用 namespace::sweep 和/或 Modern::Perl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22599829/
我想使用 Extjs 6.5.2 尝试 hello world 示例。当我尝试运行以下代码时 var containerPanel = Ext.create('Ext.panel.Panel'
在听说了Perl生态系统的新组成部分(例如Moose,DeclareX和Catalyst)之后,我认为对Perl感到高兴。不幸的是,我可以找到所有针对Perl 5.8或5.6的入门资料,而对这些较新的
HList package是基于现在古老的 Haskell 技术。一个简单的问题是:考虑到过去 8 年 Haskell/GHC 开发的所有精彩新特性,“现代”HList 的构建方式会非常不同吗?我意识
真正的现代正则表达式实际上可以识别什么类型的语言? 只要存在带有反向引用的无限长度捕获组(例如 (.*)_\1),正则表达式现在就会匹配非常规语言。但这本身不足以匹配 S::= '(' S ')' |
我必须使用 modernizer 来检测浏览器是否支持“cssscrollbar”属性,true 或 false。基于这个值,我必须做一些事情,比如添加插件和 CSS。 我正在使用下面这样的东西,我不
如何在 Relay Modern 中取消订阅? 我已经按照 How to GraphQL React + Relay 上的订阅教程进行操作但它没有提及您如何取消订阅,也没有提及 Relay Moder
我听说过很多关于这个“现代 Perl”的事情。它是什么? 我听到的一件事是新的开放语法: open my $FH, '<', $filename 并不是 open FH, "<$filename";
{这是现代接力赛} 在我的 UserQuery.js 中, class UserQuery extends Component { render () { return (
类(class)TypeCast可以追溯到 2004 年,因此 Haskell 相当“古老”(尽管仍然相当出色)。我的问题是:如果今天在最先进的 GHC 中重新实现 [最好是 7.6,但是继续,使用
我的 React 项目中有以下设置: export default class OverviewScreen extends React.Component { public render() {
在问这个可能含糊不清的问题之前,我搜索了 SO,发现许多对“现代浏览器”的引用,但没有定义。由于这是一个被广泛使用和引用的术语,令我惊讶的是我在 Internet 上找不到定义甚至描述。 那么,在 2
我正在使用字典来使用登录页面中的用户详细信息来填充列表内容。 但是我需要为每个列表项创建一个单独的源页面。 在页面加载静态源页面的那一刻,我是否可以动态设置它,即每个创建的列表链接的源页面? 或者,如
我正在 Visual Studio 上(在 C# WPF 应用程序模式下)重新制作一个在 AutoPlay media Studio 上制作的应用程序。 当我需要从计算机中获取文件时,我在 Stack
我有与此类似的 C++ 类: class A{ std::string str; public: A(std::string &str) : str(str){} int cm
现代浏览器(即 Firefox 3+、Safari 4+、IE 7+)中正则表达式的最大大小是多少?假设一个简单的正则表达式,例如“foo|bar|baz|woot|...” 最佳答案 您可以使用此代
我已经安装了 R 包 extrafont和 fontcm .然后尝试在 Sweave 中使用 Computer Modern 字体绘制数据: >= plot(na, family="CM Roman"
有什么方法可以找出现代用户界面的当前主题颜色集吗? WinAPI 函数或注册表值对我来说可能是最好的解决方案。 我的意思是当前主题颜色 this . 最佳答案 在UxTheme.dll 中有一个名为G
我正在使用带有现代中继的 react native 应用程序。 目前我们的应用程序的 fetchQuery 实现,只是在网络上做一个 fetch (就像在 https://facebook.githu
我正在使用基于 token 的身份验证,并且想知道如何在 Relay Modern 中将其完全结合在一起。我已经完成一半了。任何帮助深表感谢。这是我的设置: 位于内部顶层我渲染入口点。 内部我有一个在
是否可以使valijson与Nlohmann的json解析器一起使用,以从文件中引用其他文件中的子模式来读取架构? json mySchemaDoc; if (!valijson::utils::lo
我是一名优秀的程序员,十分优秀!