Perl 这个错误的意思是什么;导出器模块“不导出导入”;?

Perl 这个错误的意思是什么;导出器模块“不导出导入”;?,perl,Perl,正如标题所述,我在尝试使用perl模块时遇到了这个错误,但我不知道这意味着什么,而且在internet上似乎找不到任何明确的结果。我的代码由3个文件组成:一个脚本(myApp.pl),它使用一个模块(MyLib.pm),而这个模块又使用另一个模块(Secret.pm)。以下是它们的全部内容: myApp.pl #!/path/to/perl my $version = "1.0.0"; use warnings; use strict; use Testing::MyLib; MyLib.

正如标题所述,我在尝试使用perl模块时遇到了这个错误,但我不知道这意味着什么,而且在internet上似乎找不到任何明确的结果。我的代码由3个文件组成:一个脚本(myApp.pl),它使用一个模块(MyLib.pm),而这个模块又使用另一个模块(Secret.pm)。以下是它们的全部内容:

myApp.pl

#!/path/to/perl

my $version = "1.0.0";

use warnings;
use strict;
use Testing::MyLib;
MyLib.pm

package Testing::MyLib;

use strict;
use warnings;

use Testing::Secret;
下午六时三十分

package Testing::Secret;

use strict;
use warnings;

use Exporter qw( import );
our @EXPORT = ();
our %EXPORT_TAGS = (
  'all' => [ qw( MY_CONSTANT )]
);
our @EXPORT_OK = (
  @{ $EXPORT_TAGS{all}}
);

use constant MY_CONSTANT => 'bla bla bla';
它们在该文件结构中退出:

/bin/myApp.pl
/lib/perl/Testing/MyLib.pm
/lib/perl/Testing/Secret.pm
错误消息的详细信息如下:

[user@pc ~]$ myApp.pl
"import" is not exported by the Exporter module at /###/lib/perl/Testing/Secret.pm line 6
Can't continue after import errors at /###/lib/perl/Testing/Secret.pm line 6
BEGIN failed--compilation aborted at /###/lib/perl/Testing/Secret.pm line 6.
Compilation failed in require at /###/lib/perl/Testing/MyLib.pm line 6.
BEGIN failed--compilation aborted at /###/lib/perl/Testing/MyLib.pm line 6.
Compilation failed in require at /###/bin/myApp.pl line 7.
BEGIN failed--compilation aborted at /###/bin/myApp.pl line 7.
使用导出器qw(导入)import
。这是处理从模块导出的请求的方法。早于5.57的Exporter版本无法识别此请求,导致您收到错误消息

由于Exporter 5.57或更高版本从Perl 5.8.3开始就与Perl捆绑在一起,因此您必须拥有一个非常古老的Perl版本和模块

您可以升级Exporter,也可以从Exporter继承
import
,这有点混乱,但适用于任何版本的Exporter

package MyPackage;
use strict;
use warnings;
use Exporter;
our @ISA = 'Exporter';
our @EXPORT_OK = ...;

回答得好。但发问者希望对错误信息有一个实际的解释;你能在结尾加上这个吗?按照ysth的要求加上了错误的解释。请随时回复。