perl - 如何将导入语义实现到当前 block 范围?

标签 perl

use的文档表明:

Some ... pseudo-modules import semantics into the current block scope (like strict or integer , unlike ordinary modules, which import symbols into the current package (which are effective through the end of the file).

类似地,autodie

Replace functions with ones that succeed or die with lexical scope

如何用普通模块实现导入语义到当前 block 作用域?

最佳答案

strictwarnings 是使用一些不包含用户编译指示空间的特殊标志变量来实现的。从 perl 5.10 开始,您可以编写自己的词法作用域编译指示。 perlpragma包含有关如何执行此操作的信息。您还可以浏览现有实用模块的源码。

关于perl - 如何将导入语义实现到当前 block 范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5175060/

相关文章:

perl - 如何在 bash shell 脚本中的 perl 命令调用中使用 shell 变量?

perl - "Invalid argument"在 perl 中使用 3 部分打开时

Perl 数组问题

perl - 你如何最好地将 Perl 方法中的错误归因于调用者

regex - 使用 Perl 和 Regex 将文件名排序到数组中

perl - 在 perl 中使用正则表达式在两个字符串之间搜索字符串

python - Python 和 Perl 解决方案对 Wide Finder 挑战的比较

regex - 为什么我的 Perl 正则表达式使用这么多内存?

html - 如何在 Perl 中修改 HTML 文件?

perl - 是否有搜索多余代码的模块?