On Wed Jun 29 01:18:14 2016, SREZIC wrote:
Show quoted text> Compilation fails with perl 5.25.x:
>
> PERL_DL_NONLAZY=1 "/usr/perl5.22.2t/bin/perl" "-Iblib/lib" "-
> Iblib/arch" test.pl
> 1..42
> # Running under perl version 5.022002 for freebsd
> # Current time local: Wed Jun 29 07:17:07 2016
> # Current time GMT: Wed Jun 29 05:17:07 2016
> # Using Test.pm version 1.26
> Unescaped left brace in regex is deprecated, 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.
> *** Error code 255
>
> Stop.
> make: stopped in /home/cpansand/.cpan/build/2016062906/Class-HPLOO-
> 0.23-OE1Isr
It‘s not just the unescaped left brace that is a problem. I need to stop it from using defined @ to get it to pass its tests in 5.22 and higher. See the attached patch.
diff -rup Class-HPLOO-0.23-NSF84x/lib/Class/HPLOO/Base.pm Class-HPLOO-0.23-13QJN4/lib/Class/HPLOO/Base.pm
--- Class-HPLOO-0.23-NSF84x/lib/Class/HPLOO/Base.pm 2005-01-03 15:09:38.000000000 -0800
+++ Class-HPLOO-0.23-13QJN4/lib/Class/HPLOO/Base.pm 2017-04-30 17:29:10.000000000 -0700
@@ -55,7 +55,7 @@ sub SUPER {
unshift(@_ , $prev_pack) if ( $sub_is_new_hploo && $prev_pack && ((!ref($_[0]) && $_[0] ne $prev_pack && !UNIVERSAL::isa($_[0] , $prev_pack)) || (ref($_[0]) && !UNIVERSAL::isa($_[0] , $prev_pack)) ) ) ;
- if ( defined @{"$pack\::ISA"} ) {
+ if ( defined *{"$pack\::ISA"} and @{"$pack\::ISA"} ) {
my $isa_sub = ISA_FIND_NEW($pack, ($sub_is_new_hploo?'new':$sub) ,1) ;
my ($sub_name) = ( $isa_sub =~ /(\w+)$/gi );
@@ -163,7 +163,7 @@ sub new_call_BEGIN {
foreach my $isas_i ( @isas ) {
foreach my $ISA_i ( @$isas_i ) {
- if ( defined @{"$ISA_i\::ISA"} && @{"$ISA_i\::ISA"} > 2 ) {
+ if ( defined *{"$ISA_i\::ISA"} && @{"$ISA_i\::ISA"} > 2 ) {
push(@isas , \@{"$ISA_i\::ISA"}) ;
}
last if $ISA_i eq 'Class::HPLOO::Base' ;
@@ -189,7 +189,7 @@ sub new_call_END {
foreach my $isas_i ( @isas ) {
foreach my $ISA_i ( @$isas_i ) {
- if ( defined @{"$ISA_i\::ISA"} && @{"$ISA_i\::ISA"} > 2 ) {
+ if ( defined *{"$ISA_i\::ISA"} && @{"$ISA_i\::ISA"} > 2 ) {
push(@isas , \@{"$ISA_i\::ISA"}) ;
}
last if $ISA_i eq 'Class::HPLOO::Base' ;
diff -rup Class-HPLOO-0.23-NSF84x/lib/Class/HPLOO.pm Class-HPLOO-0.23-13QJN4/lib/Class/HPLOO.pm
--- Class-HPLOO-0.23-NSF84x/lib/Class/HPLOO.pm 2005-03-07 12:14:52.000000000 -0800
+++ Class-HPLOO-0.23-13QJN4/lib/Class/HPLOO.pm 2017-04-30 17:36:38.000000000 -0700
@@ -50,7 +50,7 @@ if (!$LOADED) {
unshift(@_ , $prev_pack) if ( $sub_is_new_hploo && $prev_pack && ((!ref($_[0]) && $_[0] ne $prev_pack && !UNIVERSAL::isa($_[0] , $prev_pack)) || (ref($_[0]) && !UNIVERSAL::isa($_[0] , $prev_pack)) ) ) ;
- if ( defined @{"$pack\::ISA"} ) {
+ if ( defined *{"$pack\::ISA"} and @{"$pack\::ISA"} ) {
my $isa_sub = ISA_FIND_NEW($pack, ($sub_is_new_hploo?'new':$sub) ,1) ;
my ($sub_name) = ( $isa_sub =~ /(\w+)$/gi );
if ( $sub0 ne $isa_sub && !ref($_[0]) && $isa_sub =~ /^(.*?(?:::)?$sub_name)\::$sub_name$/ ) {
@@ -1074,7 +1074,7 @@ sub format_nice_sub {
$sub =~ s/^(\s*)/$1\n$FIRST_SUB_IDENT/gs ;
$sub =~ s/\s+$//gs ;
$sub =~ s/\n[ \t]*(})$/\n$FIRST_SUB_IDENT$1/s ;
- $sub =~ s/(\S)( {) (\S)/$1$2\n$FIRST_SUB_IDENT $3/gs ;
+ $sub =~ s/(\S)( \{) (\S)/$1$2\n$FIRST_SUB_IDENT $3/gs ;
return $sub ;
}