0

I am trying to install Class::HPLOO perl module and running into issue. I am using perl version 5.28.0. I desperately need help resolve this issue and I am trying to resolve this since last few days with no luck :(.

I have tried to install via cpan and getting below error:

# 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

I have downloaded module from https://metacpan.org/pod/Class::HPLOO website and tried to install manually but same issue.

# 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

Please help resolve this issue. Thanks in advance!

2
  • I would also recommend using Moose for classes, it is the most modern approach Aug 24, 2018 at 17:29
  • Follow up question here
    – mob
    Aug 29, 2018 at 19:20

2 Answers 2

5

The CPAN testers matrix shows this module is having trouble building on Perl v5.22 or better. If you are able to use and build this module on an earlier version of Perl, that is one option for you.

The logs show the same issue you discovered: a deprecated regular expression construction, but that is not a fatal error (yet) and is not the reason your build fails.

Drilling down and running the test script with Perl v5.24 in the debugger, I see that the line

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

sets $@ (meaning that the require call failed) with the following message:

  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.

So we see that this package (which was last updated in 2005) is using the defined(@array) construction which has been deprecated for a long time and has been prohibited since v5.22.0.

The defined(@array) construction is used 4 times in lib/Class/HPLOO/Base.pm and lib/Class/HPLOO.pm. You could try to fix them yourself and rebuild the module.

2
  • Thanks mob for your response. I am trying to install this as it is required by DBD module that I was trying to install and saw below error: Can't locate Class/HPLOO/Base.pm in @INC (you may need to install the Class::HPLOO::Base module) (@INC contains: blib/lib blib/arch /opt/app/perl-5.28.0/lib/site_perl/5.28.0/x86_64-linux /opt/app/perl-5.28.0/lib/site_perl/5.28.0 /opt/app/perl-5.28.0/lib/5.28.0/x86_64-linux /opt/app/perl-5.28.0/lib/5.28.0 .) at blib/lib/HDB/Object.pm line 35. Aug 24, 2018 at 18:25
  • Thank you very much, and +1. Still worked for me in 2022 in Debian buster.
    – Binarus
    Mar 30, 2022 at 9:54
0

In addition the changes Mob suggested, you will need to edit your test.pl file for the module. In 4 locations you will find "eval { require "some/path>" } ;" change it to "eval { require "./some/path" } ;"

Also an unescaped left brace will show up which will obviously need to be escaped.

This allowed me to successfully get through the install of HPLOO and move on to the successful installation of DBD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.