From 5fd8da2a3d4f1ba9d5939f29c16f3f81dcc94d2a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 Oct 2025 23:23:07 +0000 Subject: [PATCH] treewide: don't change `use VERSION' in the same scope Perl v5.40 deprecates and warns about mismatching `use VERSION' statements until v5.44, at which point it'll become fatal and unsupported. Multiple `package' statements in the same file are considered the same scope by Perl, including string `eval' where packages are declared within the string. Furthermore, downgrading from v5.11+ to earlier versions is already fatal in v5.42, at least. It's explained somewhat unsatisfactorily in perl5360delta(1)... It appears Perl takes another step towards the path of Python and Ruby of introducing incompatibilities for minor reasons :< Reported-by: Kyle Meyer Link: https://public-inbox.org/meta/87bjmawncx.fsf@kyleam.com/ --- lib/PublicInbox/Git.pm | 4 ++-- lib/PublicInbox/TestCommon.pm | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index dcf79780e..7b315c94f 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -8,7 +8,7 @@ # There are also API changes to simplify our usage and data set. package PublicInbox::Git; use strict; -use v5.10.1; +use v5.10.1; # TODO: check unicode_strings compat use parent qw(Exporter PublicInbox::DS); use PublicInbox::DS qw(now); use autodie qw(socketpair sysread sysseek truncate); @@ -672,7 +672,7 @@ sub close { } package PublicInbox::GitCheck; # only for git <2.36 -use v5.12; +use v5.10.1; # TODO: change PublicInbox::Git to v5.12 our @ISA = qw(PublicInbox::Git); no warnings 'once'; diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 295b51d6e..46bfca585 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -364,8 +364,11 @@ sub key2sub ($) { $pkg =~ s/([a-z])([a-z0-9]+)(\.t)?\z/\U$1\E$2/; $pkg .= "_T" if $3; $pkg =~ tr/-.//d; + my $tmpdir = tmpdir; + my $pl = "$tmpdir/$pkg.pl"; $pkg = "PublicInbox::TestScript::$pkg"; - eval <', $pl, <can('main'); } } -- 2.47.3