作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在“lib”中有一个类似这样的模块,名为 Fool.pm,它基于 the source code of CGI.pm (因为这是我在考虑导出标签时想到的第一个模块):
package Fool;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw/raspberry/;
%EXPORT_TAGS = (
':all' => \@EXPORT_OK,
);
1;
use lib 'lib';
use Fool qw/:all/;
perl fool.pl
"all" is not defined in %Fool::EXPORT_TAGS at fool.pl line 2
main::BEGIN() called at lib/Fool.pm line 2
eval {...} called at lib/Fool.pm line 2
Can't continue after import errors at fool.pl line 2
BEGIN failed--compilation aborted at fool.pl line 2.
最佳答案
您的 key 中不应有冒号。另外,我认为必须声明变量 our
为了让 Exporter
可以使用它:
our @ISA = qw(Exporter);
our @EXPORT_OK = qw/raspberry/;
our %EXPORT_TAGS = (
'all' => \@EXPORT_OK,
);
关于perl - 如何使用 %EXPORT_TAGS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3177104/
我在“lib”中有一个类似这样的模块,名为 Fool.pm,它基于 the source code of CGI.pm (因为这是我在考虑导出标签时想到的第一个模块): package Fool; r
我是一名优秀的程序员,十分优秀!