我们有一个 Perl 应用程序,当我们尝试运行它时出现以下错误:
[root@simfed01 Tier7]# ./smallT.pl
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at /usr/share/perl5/CGI.pm line 528, <DATA> line 558.
Compilation failed in require at ./smallT.pl line 8, <DATA> line 558.
BEGIN 失败——编译在 ./smallT.pl 第 8 行、第 558 行中止。
这有点令人费解,因为我能够将代码从字面上削减为几个“Use”语句:
#!/bin/perl
use lib '/usr/lib/perl5/site_perl/5.8.8/'; #Needed?
use Net::LDAP;
use Data::Dumper;
use CGI;
use MIME::Base64;
use warnings;
它仍然给他同样的错误
这是 Perl 版本信息:
[root@simfed01 Tier7]# perl -v
这是为 x86_64-linux-thread-multi 构建的 perl 5,版本 26,subversion 3 (v5.26.3) (有 58 个注册补丁,请参阅 perl -V 了解更多详细信息)
这是在装有 RHEL 8 的 Redhat 机器上运行的:
[root@simfed01 Tier7]# cat /etc/redhat-release 红帽企业 Linux 版本 8.9 (Ootpa)
有谁遇到过这个问题以及如何解决吗?
谢谢, 吉姆
编辑 1:CGI 版本:
[root@simfed01 perl5]# perldoc -m CGI | grep VERSION
$CGI::VERSION='3.51';
if (exists $ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION} == 2) {
return $VERSION;
$CGI::VERSION;
OLD VERSION
NEW VERSION
编辑2:以下是该系统上CGI.pm的代码 - 它是pilcrow引用的旧版本代码。
524
525 # if we get called more than once, we want to initialize
526 # ourselves from the original query (which may be gone
527 # if it was read from STDIN originally.)
528 if (defined(@QUERY_PARAM) && !defined($initializer)) {
529 for my $name (@QUERY_PARAM) {
530 my $val = $QUERY_PARAM{$name}; # always an arrayref;
531 $self->param('-name'=>$name,'-value'=> $val);
532 if (defined $val and ref $val eq 'ARRAY') {
533 for my $fh (grep {defined(fileno($_))} @$val) {
534 seek($fh,0,0); # reset the filehandle.
这是 CGI 中的一个错误,已被修复。升级模块。