isa*_*bob 2 import perl package
该perl命令有几个防白痴命令行选项,描述perldoc perlrun如下:
-c causes Perl to check the syntax of the program and then exit without executing it.
-w prints warnings about dubious constructs, such as variable names that are mentioned only once and scalar variables that are used before being set, etc.
-T forces "taint" checks to be turned on so you can test them.
Run Code Online (Sandbox Code Playgroud)
通读这些选项后,我找不到检测未定义函数的选项。例如,我使用了一个名为NFD()导入Unicode::Normalize包的函数。然而,作为一个 perl 新手,我不知道这是否已经在标准 perl 库的范围内。并且perl -c任何其他选项都没有为我发现这个错误,而是一位同事注意到它以某种方式未定义(并且不在标准库中)。因此,我对以下内容感到好奇:
perl命令中是否有选项可以自动检测导入的包中是否存在未定义的函数?
我不知道这是否已经在标准 perl 库中。
听起来您想将导入的 subs 与其他 subs 和内置函数区分开来。
如果你总是明确地列出你的导入,而不是像我一样接受默认值,那么你不仅会知道哪些子被导入,你还会知道它们是从哪个模块导入的。
use Foo::Bar; # Default imports
use Foo::Bar qw( ); # Import nothing ("()" also works)
use Foo::Bar qw( foo bar ); # Import subs foo and bar.
Run Code Online (Sandbox Code Playgroud)
perl 命令中是否有选项可以检查未定义的函数?
另一方面,如果您试图识别您调用的不存在或未在编译时定义的子程序,那么此问题与如何消除未定义的子程序?.
| 归档时间: |
|
| 查看次数: |
167 次 |
| 最近记录: |