本文介绍了perl module类别:: HPLOO v0.23安装问题#2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具有如下所述的确切问题: perl模块Class :: HPLOO v0 .23安装问题,我试图通过编辑为(@array)并尝试重建模块来纠正defined(@array)问题.但是我继续得到以下回报:

Having the exact issue as described at: perl module Class::HPLOO v0.23 install issue, I have attempted to correct the defined(@array) problem by editing to just (@array) and trying to rebuild the module. However I continue to get the return of:

$ make clean
$ perl Makefile.PL
$ make
$ make test: *** No rule to
make target `clean:'.  Stop. Manifying 2 pod documents
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.26" "-Iblib/lib" "-Iblib/arch"
test.pl
1..42
# Running under perl version 5.026002 for darwin
# Current time local: Sun Aug 26 06:48:26 2018
# Current time GMT:   Sat Aug 25 22:48:26 2018
# Using Test.pm version 1.26 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

推荐答案

Class::HPLOO存在三个问题(正如我之前提到的那样,自2005年以来就没有更新),这使它在现代Perls中失败了. >

There are three issues with Class::HPLOO (which as I noted before, hasn't been updated since 2005) that make it fail with modern perls.

  1. 如上一篇文章中发现的,过时的构造defined (@array)lib/Class/HPLOO.pm' and three times in lib/Class/HPLOO/Base.pm`中使用了一次.自v5.22起已禁止这种构造

  1. As discovered in the previous post, the obsolete construct defined (@array) is used once in lib/Class/HPLOO.pm' and three times inlib/Class/HPLOO/Base.pm`. This construction has been prohibited since v5.22

当前目录(.)不再位于@INC中(我认为从v5.24开始).所以test.pl中的行就像

The current directory (.) is no longer in @INC (as of v5.24, I think). So the lines in test.pl like

require "test/classtest.pm"

全部都需要改写为

    require "./test/classtest.pm"

或更简单的解决方法是放置

or an easier fix is to put

    use lib '.';

在脚本顶部.

  1. lib/Class/HPLOO.pm行1077中有一个正则表达式,带有未转义的左括号"

  1. There is a regular expression in lib/Class/HPLOO.pm, line 1077, with an "unescaped left brace"

  $sub =~ s/(\S)( {) (\S)/$1$2\n$FIRST_SUB_IDENT  $3/gs ;

{是正则表达式元字符,并且从v5.22开始,在不表示数量的情况下使用它是非法的.如错误消息所建议的,解决方法是将其转义.

{ is a regex metacharacter, and since v5.22 it has been illegal to use it in a context where it is not indicating a quantity. The fix, as the error message suggests, is to escape it.

      $sub =~ s/(\S)( \{) (\S)/$1$2\n$FIRST_SUB_IDENT  $3/gs ;

对从CPAN下载的代码进行以下三处更改,并且该模块应基于现代Perls构建.如果您觉得有帮助,可以提交错误报告(如果需要,可以链接到此帖子),甚至可以将修补程序与电子邮件一起发送给[email protected]

Make these three changes to the code you download from CPAN and the module should build on modern Perls. If you're feeling helpful, you can submit a bug report (linking to this post, if you want) or even a patch with an email to [email protected]

这篇关于perl module类别:: HPLOO v0.23安装问题#2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 05:47