Reputation: 53
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
Upvotes: 2
Views: 725
Reputation: 3134
come across this issue today, so I fixed it following the answer above. if anyone want to save some time.
I create a repo with the changes. https://github.com/swuecho/Class_HPLOO.git
Upvotes: 1
Reputation: 118665
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.
As discovered in the previous post,
the obsolete construct defined (@array)
is used once in lib/Class/HPLOO.pm' and three times in
lib/Class/HPLOO/Base.pm`. This construction has been prohibited since v5.22
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"
either all need to be rewritten as
require "./test/classtest.pm"
or an easier fix is to put
use lib '.';
at the top of the script.
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 ;
{
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 ;
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]
Upvotes: 1