[sf-perl] FreeBSD 12.2 lang/perl5-5.32.1_1 experimental 'isa' infix operator breaks UNIVERSAL::ISA
David Christensen
dpchrist at holgerdanske.com
Sun Feb 28 17:22:33 PST 2021
sfpm:
Regarding the experimental binary infix 'isa' introduced recently as an
experimental feature and how it breaks UNIVERSAL::isa(), a shortened
version of my test script follows with sample runs.
Can anyone confirm the failures on Perl 5.32.0? 5.32.1?
David
2021-02-28 17:20:51 dpchrist at tinkywinky ~/sandbox/perl/p5p
$ cat bug.t
#!perl
# $Id: bug.t,v 1.6 2021/03/01 01:20:50 dpchrist Exp $
# By David Paul Christensen dpchrist at holgerdanske.com
# Public Domain.
#
# Demonstrates bug in UNIVERSAL::isa() when experimental 'isa'
# binary infix operator is enabled. Operator was introduced in Perl
# 5.32.0 (?). Breakage confirmed on FreeBSD 12.2 with Perl 5.32.1.
#
# See discussion on Perl 5 Porters mailing list
# https://www.nntp.perl.org/group/perl.perl5.porters/2021/02/msg259150.html
use strict;
use warnings;
use Test::More;
my $aobj = bless [ 5, 6, 7 ], "MyArray::Class";
SKIP: {
skip 'Requires Perl version 5.32.0 or newer', 2
unless 5.032000 <= $];
eval q(
use experimental 'isa';
is(($aobj isa MyArray::Class), 1, 'line ' . __LINE__);
is(($aobj isa ARRAY), 1, 'line ' . __LINE__);
);
}
is eval q{ $aobj->isa('MyArray::Class') }, 1, 'line ' . __LINE__;
is eval q{ $aobj->isa('ARRAY') }, 1, 'line ' . __LINE__;
done_testing;
__END__
### sample run on Perl 5.24.1 -- UNIVERSAL::isa() works as expected
2021-02-28 17:13:39 dpchrist at tinkywinky ~/sandbox/perl/p5p
$ cat /etc/debian_version ; uname -a ; perl -v | head -n 2
9.13
Linux tinkywinky 4.9.0-14-amd64 #1 SMP Debian 4.9.246-2 (2020-12-17)
x86_64 GNU/Linux
This is perl 5, version 24, subversion 1 (v5.24.1) built for
x86_64-linux-gnu-thread-multi
2021-02-28 17:14:13 dpchrist at tinkywinky ~/sandbox/perl/p5p
$ perl bug.t
ok 1 # skip Requires Perl version 5.32.0 or newer
ok 2 # skip Requires Perl version 5.32.0 or newer
ok 3 - line 32
ok 4 - line 34
1..4
### sample run on Perl 5.32.1 -- UNIVERSAL::isa() broken
2021-02-28 17:10:58 dpchrist at f3 ~/sandbox/perl/p5p
$ freebsd-version ; uname -a ; perl -v | head -n 2
12.2-RELEASE-p4
FreeBSD f3.tracy.holgerdanske.com 12.2-RELEASE-p4 FreeBSD
12.2-RELEASE-p4 GENERIC amd64
This is perl 5, version 32, subversion 1 (v5.32.1) built for
amd64-freebsd-thread-multi
2021-02-28 17:15:18 dpchrist at f3 ~/sandbox/perl/p5p
$ perl bug.t
ok 1 - line 4
ok 2 - line 6
not ok 3 - line 32
# Failed test 'line 32'
# at bug.t line 32.
# got: undef
# expected: '1'
not ok 4 - line 34
# Failed test 'line 34'
# at bug.t line 34.
# got: undef
# expected: '1'
1..4
# Looks like you failed 2 tests of 4.
More information about the SanFrancisco-pm
mailing list