0

我正在尝试安装 Class::HPLOO perl 模块并遇到问题。我正在使用 perl 版本 5.28.0。我迫切需要帮助解决这个问题,我从最近几天开始尝试解决这个问题,但没有运气:(。

我试图通过 cpan 安装并得到以下错误:

# Running under perl version 5.028000 for linux
# Current time local: Thu Aug 23 22:50:40 2018
# Current time GMT:   Fri Aug 24 02:50:40 2018
# Using Test.pm version 1.31
Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.32), passed through in regex; marked by <-- HERE in m/({ <-- HERE \s+)/ at blib/lib/Class/HPLOO.pm line 1072.
Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/(\S)( { <-- HERE ) (\S)/ at blib/lib/Class/HPLOO.pm line 1077.
not ok 1
# Failed test 1 in test.pl at line 9
#  test.pl line 9 is:   ok(!$@) ;
Undefined subroutine &Foo::new_call_BEGIN called at test/classtest.pm line 5.
make: *** [test_dynamic] Error 255

我已经从https://metacpan.org/pod/Class::HPLOO网站下载了模块并尝试手动安装但同样的问题。

# Running under perl version 5.028000 for linux
# Current time local: Fri Aug 24 12:42:24 2018
# Current time GMT:   Fri Aug 24 16:42:24 2018
# Using Test.pm version 1.31
not ok 1
# Failed test 1 in test.pl at line 9
#  test.pl line 9 is:   ok(!$@) ;
Can't locate object method "new" via package "Foo" at test.pl line 11.
make: *** [test_dynamic] Error 2

请帮助解决此问题。提前致谢!

4

2 回答 2

4

CPAN 测试人员矩阵显示此模块在Perl v5.22 或更高版本上构建时遇到问题。如果您能够在早期版本的 Perl 上使用和构建此模块,那是您的一个选择。

日志显示了您发现的相同问题:不推荐使用的正则表达式构造,但这还不是致命错误,也不是您的构建失败的原因。

在调试器中使用 Perl v5.24 向下钻取并运行测试脚本,我看到该行

eval { require "test/classtest.pm" } ;

设置$@(表示require呼叫失败)并显示以下消息:

  DB<1> p $@                                                                                                                                                   
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at test/classtest.pm line 5.
 at test/classtest.pm line 5.
        require test/classtest.pm called at test.pl line 8
        eval {...} called at test.pl line 8
Compilation failed in require at test.pl line 8.

所以我们看到这个包(最后一次更新是在 2005 年)使用的defined(@array)结构已经被弃用了很长时间,并且从 v5.22.0 开始就被禁止了

该结构在和defined(@array)中使用了 4 次。您可以尝试自己修复它们并重建模块。lib/Class/HPLOO/Base.pmlib/Class/HPLOO.pm

于 2018-08-24T17:29:57.153 回答
0

除了 Mob 建议的更改之外,您还需要为模块编辑 test.pl 文件。在 4 个位置,您会发现“eval { require "some/path>" } ;" 将其更改为 "eval { 要求 "./some/path" } ;"

还会出现一个未转义的左大括号,显然需要转义。

这使我能够成功完成 HPLOO 的安装并继续成功安装 DBD。

于 2018-08-26T01:47:11.863 回答