From 9eacc8fb7c86c252d789b58c3b2e76074ec80e51 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 9 Dec 2024 17:03:28 +0100 Subject: [PATCH 01/18] drop the 5 This commit drop PERL_REVISION from $] and $^V. Since $^V expects 3 components, we add a .0 at the end. --- Configure | 14 +++++++------- Porting/makerel | 3 +-- myconfig.SH | 2 +- perl.c | 5 ++--- perl.h | 8 +++----- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Configure b/Configure index 7868560295fb..f187b59c74ea 100755 --- a/Configure +++ b/Configure @@ -7118,16 +7118,16 @@ $echo "(You have $package $version_patchlevel_string.)" case "$osname" in dos|vms) : XXX Should be a Configure test for double-dots in filenames. - version=`echo $revision $patchlevel $subversion | \ - $awk '{ printf "%d_%d_%d", $1, $2, $3 }'` - api_versionstring=`echo $api_revision $api_version $api_subversion | \ - $awk '{ printf "%d_%d_%d", $1, $2, $3 }'` + version=`echo $patchlevel $subversion | \ + $awk '{ printf "%d_%d", $1, $2 }'` + api_versionstring=`echo $api_version $api_subversion | \ + $awk '{ printf "%d_%d", $1, $2 }'` ;; *) - version=`echo $revision $patchlevel $subversion | \ - $awk '{ printf "%d.%d.%d", $1, $2, $3 }'` + version=`echo $patchlevel $subversion | \ + $awk '{ printf "%d.%d", $1, $2 }'` api_versionstring=`echo $api_revision $api_version $api_subversion | \ - $awk '{ printf "%d.%d.%d", $1, $2, $3 }'` + $awk '{ printf "%d.%d", $1, $2 }'` ;; esac : Special case the 5.005_xx maintenance series, which used 5.005 diff --git a/Porting/makerel b/Porting/makerel index ce553a952e95..a65b2a93504b 100755 --- a/Porting/makerel +++ b/Porting/makerel @@ -62,11 +62,10 @@ my @patchlevel_h = ; close PATCHLEVEL; my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h; print $patchlevel_h; -my $revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/; my $patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/; my $subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/; die "Unable to parse patchlevel.h" unless $subversion >= 0; -my $vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion); +my $vers = sprintf("%d.%d", $patchlevel, $subversion); # fetch list of local patches my (@local_patches, @lpatch_tags, $lpatch_tags); diff --git a/myconfig.SH b/myconfig.SH index 1e8ae0bb9a49..6903e771f6dc 100755 --- a/myconfig.SH +++ b/myconfig.SH @@ -29,7 +29,7 @@ $startsh # Note that the text lines /^Summary of/ .. /^\s*$/ are copied into Config.pm. cat <<'!NO!SUBS!' -Summary of my $package (revision $revision $version_patchlevel_string) configuration: +Summary of my $package ($version_patchlevel_string) configuration: $git_commit_id_title $git_commit_id$git_ancestor_line Platform: osname=$osname diff --git a/perl.c b/perl.c index 234b1c910c3f..f80d18a15581 100644 --- a/perl.c +++ b/perl.c @@ -4011,9 +4011,8 @@ S_minus_v(pTHX) #endif /* #ifdef PERL_PATCHNUM */ PIO_stdout = PerlIO_stdout(); PerlIO_printf(PIO_stdout, - "\nThis is perl " STRINGIFY(PERL_REVISION) - ", version " STRINGIFY(PERL_VERSION) - ", subversion " STRINGIFY(PERL_SUBVERSION) + "\nThis is perl, version " STRINGIFY(PERL_VERSION) + ", subversion " STRINGIFY(PERL_SUBVERSION) " (%" SVf ") built for " ARCHNAME, SVfARG(level) ); SvREFCNT_dec_NN(level); diff --git a/perl.h b/perl.h index a55ea2b458c3..eea2df0ac234 100644 --- a/perl.h +++ b/perl.h @@ -5351,12 +5351,10 @@ EXTERN_C char **environ; /* environment variables supplied via exec */ #include "patchlevel.h" #undef PERL_PATCHLEVEL_H_IMPLICIT -#define PERL_VERSION_STRING STRINGIFY(PERL_REVISION) "." \ - STRINGIFY(PERL_VERSION) "." \ - STRINGIFY(PERL_SUBVERSION) +#define PERL_VERSION_STRING STRINGIFY(PERL_VERSION) "." \ + STRINGIFY(PERL_SUBVERSION) ".0" -#define PERL_API_VERSION_STRING STRINGIFY(PERL_API_REVISION) "." \ - STRINGIFY(PERL_API_VERSION) "." \ +#define PERL_API_VERSION_STRING STRINGIFY(PERL_API_VERSION) "." \ STRINGIFY(PERL_API_SUBVERSION) START_EXTERN_C From de60ecdc84a72e3ccb72054e132babf5ec31b2d8 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Wed, 11 Dec 2024 21:32:03 +0100 Subject: [PATCH 02/18] create the :42 feature bundle The FEATURE_BUNDLE_xxx constants in feature.h must be ordered by version. The 'as_bundles' sort function ensures that all bundles will be sorted correctly (except for 5.9.5, which ends up between 5.41 and 41). --- lib/feature.pm | 5 +++-- regen/feature.pl | 30 ++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/feature.pm b/lib/feature.pm index d6afdd09f2f9..a98521cd90f6 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -70,8 +70,9 @@ $feature_bundle{"5.34"} = $feature_bundle{"5.27"}; $feature_bundle{"5.36"} = $feature_bundle{"5.35"}; $feature_bundle{"5.38"} = $feature_bundle{"5.37"}; $feature_bundle{"5.40"} = $feature_bundle{"5.39"}; -$feature_bundle{"5.42"} = $feature_bundle{"5.41"}; $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"}; +$feature_bundle{"41"} = $feature_bundle{"5.41"}; +$feature_bundle{"42"} = $feature_bundle{"5.41"}; my %noops = ( postderef => 1, lexical_subs => 1, @@ -647,7 +648,7 @@ The following feature bundles are available: postderef_qq say signatures state try unicode_eval unicode_strings - :5.42 bitwise current_sub evalbytes fc isa + :42 bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state try unicode_eval unicode_strings diff --git a/regen/feature.pl b/regen/feature.pl index 59ca415f4c8f..c2cb0eb46455 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -107,8 +107,18 @@ BEGIN "5.39" => [ +V5_39 ], # using 5.41 features bundle "5.41" => [ +V5_41 ], + # using 41 features bundle + "41" => [ +V5_41 ], ); +# actually, 5.9.5 ends up between 5.41 and 41 +sub as_bundles { + $a eq 'default' ? -1 : $b eq 'default' ? 1 # default first + : $a eq 'all' ? 1 : $b eq 'all' ? -1 # all last + : $a =~ /\./ ? $b =~ /\./ ? $a cmp $b : -1 # 5.x in order, before + : $b =~ /\./ ? 1 : $a <=> $b; # integers in order +} + my @noops = qw( postderef lexical_subs ); my @removed = qw( array_base switch ); @@ -134,13 +144,18 @@ BEGIN my $cop_feature_size = $mask == 1 ? $index : $index + 1; for (keys %feature_bundle) { - next unless /^5\.(\d*[13579])\z/; - $feature_bundle{"5.".($1+1)} ||= $feature_bundle{$_}; + if (/^5\.(\d*[13579])\z/) { # 5.x dev series + $feature_bundle{"5.".($1+1)} ||= $feature_bundle{$_}; + } + elsif (/^([4-9][13579]|[1-9][0-9]+[13579])\z/) { # 41 and above + $feature_bundle{($1+1)} ||= $feature_bundle{$_}; + } } +delete $feature_bundle{"5.42"}; # this one does not exist my %UniqueBundles; # "say state switch" => 5.10 my %Aliases; # 5.12 => 5.11 -for( sort keys %feature_bundle ) { +for( sort as_bundles keys %feature_bundle ) { my $value = join(' ', sort @{$feature_bundle{$_}}); if (exists $UniqueBundles{$value}) { $Aliases{$_} = $UniqueBundles{$value}; @@ -152,8 +167,7 @@ BEGIN # start end my %BundleRanges; # say => ['5.10', '5.15'] # unique bundles for values for my $bund ( - sort { $a eq 'default' ? -1 : $b eq 'default' ? 1 : $a cmp $b } - values %UniqueBundles + sort as_bundles values %UniqueBundles ) { next if $bund =~ /[^\d.]/ and $bund ne 'default'; for (@{$feature_bundle{$bund}}) { @@ -199,7 +213,7 @@ BEGIN die "No HINT_UNI_8_BIT defined in perl.h" unless $Uni8Bit; my @HintedBundles = - ('default', grep !/[^\d.]/, sort values %UniqueBundles); + ('default', grep !/[^\d.]/, sort as_bundles values %UniqueBundles); ########################################################################### @@ -246,7 +260,7 @@ sub longest { } print $pm ");\n\n"; -for (sort keys %Aliases) { +for (sort as_bundles keys %Aliases) { print $pm qq'\$feature_bundle{"$_"} = \$feature_bundle{"$Aliases{$_}"};\n'; }; @@ -283,7 +297,7 @@ sub longest { $::bundle, $::feature . -for ('default', sort grep /\.\d[02468]/, keys %feature_bundle) { +for ('default', sort as_bundles grep /[02468]\z/, keys %feature_bundle) { $::bundle = ":$_"; $::feature = join ' ', @{$feature_bundle{$_}}; write $pm; From f7c41d85a067d74d67d095d912f31d9f05316fb7 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Wed, 11 Dec 2024 23:14:07 +0100 Subject: [PATCH 03/18] fix the test for perl -v --- t/run/switches.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/run/switches.t b/t/run/switches.t index f72949f2ca6f..f39d7a30a50c 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -310,7 +310,7 @@ is runperl(stderr => 1, prog => '#!perl -M'), my $ver = $Config{PERL_VERSION}; my $rel = $Config{PERL_SUBVERSION}; like( runperl( switches => ['-v'] ), - qr/This is perl 5, version \Q$ver\E, subversion \Q$rel\E \(v\Q$v\E(?:[-*\w]+| \([^)]+\))?\) built for \Q$Config{archname}\E.+Copyright.+Larry Wall.+Artistic License.+GNU General Public License/s, + qr/This is perl, version \Q$ver\E, subversion \Q$rel\E \(v\Q$v\E(?:[-*\w]+| \([^)]+\))?\) built for \Q$Config{archname}\E.+Copyright.+Larry Wall.+Artistic License.+GNU General Public License/s, '-v looks okay' ); } } From 376914456c10bc11acc61d438b88cfe10f8d618a Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:26:48 +0100 Subject: [PATCH 04/18] [CPAN-Meta-Requirements] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; --- cpan/CPAN-Meta-Requirements/t/from-hash.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpan/CPAN-Meta-Requirements/t/from-hash.t b/cpan/CPAN-Meta-Requirements/t/from-hash.t index 400b846d6b81..e97b573d6d3c 100644 --- a/cpan/CPAN-Meta-Requirements/t/from-hash.t +++ b/cpan/CPAN-Meta-Requirements/t/from-hash.t @@ -43,7 +43,7 @@ for my $string (10, '>= 2, <= 9, != 7') { SKIP: { skip "Can't tell v-strings from strings until 5.8.1", 1 - unless $] gt '5.008'; + unless "$]" > 5.008; my $string_hash = { Left => 10, Shared => '= 2', @@ -87,7 +87,7 @@ SKIP: { SKIP: { skip "Can't tell v-strings from strings until 5.8.1", 2 - unless $] gt '5.008'; + unless "$]" > 5.008; my $string_hash = { Left => 10, Shared => v50.44.60, From e570b86e230be8b291449a1198b8a83ed16dcf45 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:26:48 +0100 Subject: [PATCH 05/18] [CPAN-Meta] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; --- cpan/CPAN-Meta/lib/CPAN/Meta.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta.pm b/cpan/CPAN-Meta/lib/CPAN/Meta.pm index 4a8e65c0fc1f..d1ee1f00b8d7 100644 --- a/cpan/CPAN-Meta/lib/CPAN/Meta.pm +++ b/cpan/CPAN-Meta/lib/CPAN/Meta.pm @@ -398,7 +398,7 @@ sub save { my ($self, $file, $options) = @_; my $version = $options->{version} || '2'; - my $layer = $] ge '5.008001' ? ':utf8' : ''; + my $layer = "$]" >= 5.008001 ? ':utf8' : ''; if ( $version ge '2' ) { carp "'$file' should end in '.json'" From 8440144acfb5660ed849c300b29db4969a81800a Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:26:48 +0100 Subject: [PATCH 06/18] [HTTP-Tiny] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; --- cpan/HTTP-Tiny/lib/HTTP/Tiny.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm index 6ce4e044bb65..ca107fa290ba 100644 --- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm +++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm @@ -865,7 +865,7 @@ sub _prepare_headers_and_cb { } elsif ( length $args->{content} ) { my $content = $args->{content}; - if ( $] ge '5.008' ) { + if ( "$]" >= 5.008 ) { utf8::downgrade($content, 1) or die(qq/Wide character in request message body\n/); } @@ -1032,7 +1032,7 @@ my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/; sub _uri_escape { my ($self, $str) = @_; return "" if !defined $str; - if ( $] ge '5.008' ) { + if ( "$]" >= 5.008 ) { utf8::encode($str); } else { @@ -1189,7 +1189,7 @@ sub write { @_ == 2 || die(q/Usage: $handle->write(buf)/ . "\n"); my ($self, $buf) = @_; - if ( $] ge '5.008' ) { + if ( "$]" >= 5.008 ) { utf8::downgrade($buf, 1) or die(qq/Wide character in write()\n/); } @@ -1474,7 +1474,7 @@ sub write_content_body { defined $data && length $data or last; - if ( $] ge '5.008' ) { + if ( "$]" >= 5.008 ) { utf8::downgrade($data, 1) or die(qq/Wide character in write_content()\n/); } @@ -1521,7 +1521,7 @@ sub write_chunked_body { defined $data && length $data or last; - if ( $] ge '5.008' ) { + if ( "$]" >= 5.008 ) { utf8::downgrade($data, 1) or die(qq/Wide character in write_chunked_body()\n/); } From 1e1a9b249b78e19fcaf85374822ef9476e5b1cd2 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Mon, 30 Dec 2024 12:16:03 +0100 Subject: [PATCH 07/18] [Pod-Simple] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; Note that, because some of the files do a `use integer`, the numeric comparisons with $] a `no integer` needs to be done in a lexical scope around the comparison, to avoid truncation to integers, which spoils the comparisons. Hence the ugly `do { no integer ; ... }` in some places. --- cpan/Pod-Simple/lib/Pod/Simple.pm | 8 ++++---- cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm | 10 +++++----- cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm | 2 +- cpan/Pod-Simple/lib/Pod/Simple/HTML.pm | 8 ++++---- cpan/Pod-Simple/lib/Pod/Simple/RTF.pm | 4 ++-- cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm | 2 +- cpan/Pod-Simple/t/ascii_order.pl | 2 +- cpan/Pod-Simple/t/encod04.t | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cpan/Pod-Simple/lib/Pod/Simple.pm b/cpan/Pod-Simple/lib/Pod/Simple.pm index 9e521ad27449..c96ff2b00cb8 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple.pm @@ -33,8 +33,8 @@ BEGIN { die "MANY_LINES is too small (", MANY_LINES(), ")!\nAborting"; } if(defined &UNICODE) { } - elsif($] >= 5.008) { *UNICODE = sub() {1} } - else { *UNICODE = sub() {''} } + elsif( do { no integer; "$]" >= 5.008 } ) { *UNICODE = sub() {1} } + else { *UNICODE = sub() {''} } } if(DEBUG > 2) { print STDERR "# We are ", ASCII ? '' : 'not ', "in ASCII-land\n"; @@ -42,8 +42,8 @@ if(DEBUG > 2) { } # The NO BREAK SPACE and SOFT HYHPEN are used in several submodules. -if ($] ge 5.007_003) { # On sufficiently modern Perls we can handle any - # character set +if ( do { no integer; "$]" >= 5.007_003 } ) { # On sufficiently modern Perls we can handle any + # character set $Pod::Simple::nbsp = chr utf8::unicode_to_native(0xA0); $Pod::Simple::shy = chr utf8::unicode_to_native(0xAD); } diff --git a/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm b/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm index 242a4eb117ac..f5a70982127c 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm @@ -35,7 +35,7 @@ sub my_qr ($$) { my ($input_re, $should_match) = @_; # XXX could have a third parameter $shouldnt_match for extra safety - my $use_utf8 = ($] le 5.006002) ? 'use utf8;' : ""; + my $use_utf8 = do { no integer; $] <= 5.006002 } ? 'use utf8;' : ""; my $re = eval "no warnings; $use_utf8 qr/$input_re/"; #print STDERR __LINE__, ": $input_re: $@\n" if $@; @@ -93,7 +93,7 @@ my $deprecated_re = my_qr('\p{IsDeprecated}', "\x{149}"); $deprecated_re = qr/\x{149}/ unless $deprecated_re; my $utf8_bom; -if (($] ge 5.007_003)) { +if ( do { no integer; "$]" >= 5.007_003 }) { $utf8_bom = "\x{FEFF}"; utf8::encode($utf8_bom); } else { @@ -266,13 +266,13 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines) # XXX probably if the line has E that evaluates to illegal CP1252, # then it is UTF-8. But we haven't processed E<> yet. - goto set_1252 if $] lt 5.006_000; # No UTF-8 on very early perls + goto set_1252 if do { no integer; "$]" < 5.006_000 }; # No UTF-8 on very early perls my $copy; no warnings 'utf8'; - if ($] ge 5.007_003) { + if ( do { no integer; "$]" >= 5.007_003 } ) { $copy = $line; # On perls that have this function, we can use it to easily see if the @@ -286,7 +286,7 @@ sub parse_lines { # Usage: $parser->parse_lines(@lines) } else { # ASCII, no decode(): do it ourselves using the fundamental # characteristics of UTF-8 - use if $] le 5.006002, 'utf8'; + use if do { no integer; "$]" <= 5.006002 }, 'utf8'; my $char_ord; my $needed; # How many continuation bytes to gobble up diff --git a/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm b/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm index 3205f90d4602..0d74509bac32 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple/DumpAsXML.pm @@ -67,7 +67,7 @@ sub _handle_element_end { sub _xml_escape { foreach my $x (@_) { # Escape things very cautiously: - if ($] ge 5.007_003) { + if ("$]" >= 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; diff --git a/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm b/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm index 04659fea0bd5..cf8982f76da6 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple/HTML.pm @@ -701,7 +701,7 @@ sub section_name_tidy { $section =~ s/^\s+//; $section =~ s/\s+$//; $section =~ tr/ /_/; - if ($] ge 5.006) { + if ("$]" >= 5.006) { $section =~ s/[[:cntrl:][:^ascii:]]//g; # drop crazy characters } elsif ('A' eq chr(65)) { # But not on early EBCDIC $section =~ tr/\x00-\x1F\x80-\x9F//d; @@ -724,7 +724,7 @@ sub general_url_escape { # A pretty conservative escaping, behoovey even for query components # of a URL (see RFC 2396) - if ($] ge 5.007_003) { + if ("$]" >= 5.007_003) { $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',utf8::native_to_unicode(ord($1)))/eg; } else { # Is broken for non-ASCII platforms on early perls $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',ord($1))/eg; @@ -862,7 +862,7 @@ sub esc { # a function. @_ = splice @_; # break aliasing } else { my $x = shift; - if ($] ge 5.007_003) { + if ("$]" >= 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; @@ -873,7 +873,7 @@ sub esc { # a function. foreach my $x (@_) { # Escape things very cautiously: if (defined $x) { - if ($] ge 5.007_003) { + if ("$]" >= 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg diff --git a/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm b/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm index e5f0e2c79afb..cd00da0cc77a 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple/RTF.pm @@ -18,7 +18,7 @@ sub to_uni ($) { # Convert native code point to Unicode my $x = shift; # Broken for early EBCDICs - $x = chr utf8::native_to_unicode(ord $x) if $] ge 5.007_003 + $x = chr utf8::native_to_unicode(ord $x) if "$]" >= 5.007_003 && ord("A") != 65; return $x; } @@ -549,7 +549,7 @@ my $other_unicode = Pod::Simple::BlackBox::my_qr('([\x{10000}-\x{10FFFF}])', "\x{10000}"); sub esc_uni($) { - use if $] le 5.006002, 'utf8'; + use if do { no integer; "$]" <= 5.006002 }, 'utf8'; my $x = shift; diff --git a/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm b/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm index e45b47e5502c..156760abb91a 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm @@ -76,7 +76,7 @@ sub _handle_element_end { sub _xml_escape { foreach my $x (@_) { # Escape things very cautiously: - if ($] ge 5.007_003) { + if ("$]" >= 5.007_003) { $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; } else { # Is broken for non-ASCII platforms on early perls $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; diff --git a/cpan/Pod-Simple/t/ascii_order.pl b/cpan/Pod-Simple/t/ascii_order.pl index 3b453f12be8a..b178ea780a7a 100644 --- a/cpan/Pod-Simple/t/ascii_order.pl +++ b/cpan/Pod-Simple/t/ascii_order.pl @@ -5,7 +5,7 @@ ($) my $string = shift; return $string if ord("A") == 65 - || $] lt 5.007_003; # Doesn't work on early EBCDIC Perls + || "$]" < 5.007_003; # Doesn't work on early EBCDIC Perls my $output = ""; for my $i (0 .. length($string) - 1) { $output .= chr(utf8::native_to_unicode(ord(substr($string, $i, 1)))); diff --git a/cpan/Pod-Simple/t/encod04.t b/cpan/Pod-Simple/t/encod04.t index 2219e8c05fe0..78df12c550eb 100644 --- a/cpan/Pod-Simple/t/encod04.t +++ b/cpan/Pod-Simple/t/encod04.t @@ -18,7 +18,7 @@ use Pod::Simple::XMLOutStream; my $x97; my $x91; my $dash; -if ($] ge 5.007_003) { +if ("$]" >= 5.007_003) { $x97 = chr utf8::unicode_to_native(0x97); $x91 = chr utf8::unicode_to_native(0x91); $dash = '—'; From 58aaa5e1f889924b27e2486f4a270ee46b80deda Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:26:48 +0100 Subject: [PATCH 08/18] [Scalar-List-Utils] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; --- cpan/Scalar-List-Utils/t/stack-corruption.t | 2 +- cpan/Scalar-List-Utils/t/sum.t | 2 +- cpan/Scalar-List-Utils/t/uniq.t | 6 +++--- cpan/Scalar-List-Utils/t/uniqnum.t | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpan/Scalar-List-Utils/t/stack-corruption.t b/cpan/Scalar-List-Utils/t/stack-corruption.t index 03f141af6817..3227ebae686e 100644 --- a/cpan/Scalar-List-Utils/t/stack-corruption.t +++ b/cpan/Scalar-List-Utils/t/stack-corruption.t @@ -1,7 +1,7 @@ #!./perl BEGIN { - if ($] eq "5.008009" or $] eq "5.010000" or $] le "5.006002") { + if ("$]" == 5.008009 or "$]" == 5.010000 or "$]" <= 5.006002) { print "1..0 # Skip: known to fail on $]\n"; exit 0; } diff --git a/cpan/Scalar-List-Utils/t/sum.t b/cpan/Scalar-List-Utils/t/sum.t index 5247a37b004c..9e4fe2e2db83 100644 --- a/cpan/Scalar-List-Utils/t/sum.t +++ b/cpan/Scalar-List-Utils/t/sum.t @@ -98,7 +98,7 @@ SKIP: { cmp_ok($t, 'gt', 1152921504606846976, 'sum uses IV where it can'); # string comparison because Perl 5.6 does not compare it numerically correctly SKIP: { - skip "known to fail on $]", 1 if $] le "5.006002"; + skip "known to fail on $]", 1 if "$]" <= 5.006002; $t = sum(1<<60, 1); cmp_ok($t, '>', 1<<60, 'sum uses IV where it can'); } diff --git a/cpan/Scalar-List-Utils/t/uniq.t b/cpan/Scalar-List-Utils/t/uniq.t index d296aa8d571a..712955267779 100644 --- a/cpan/Scalar-List-Utils/t/uniq.t +++ b/cpan/Scalar-List-Utils/t/uniq.t @@ -44,7 +44,7 @@ is_deeply( [ uniqstr qw( 1 1.0 1E0 ) ], } SKIP: { - skip 'Perl 5.007003 with utf8::encode is required', 3 if $] lt "5.007003"; + skip 'Perl 5.007003 with utf8::encode is required', 3 if "$]" < 5.007003; my $warnings = ""; local $SIG{__WARN__} = sub { $warnings .= join "", @_ }; @@ -99,7 +99,7 @@ is_deeply( [ uniqint 6.1, 6.2, 6.3 ], } SKIP: { - skip('UVs are not reliable on this perl version', 2) unless $] ge "5.008000"; + skip('UVs are not reliable on this perl version', 2) unless "$]" >= 5.008000; my $maxbits = $Config{ivsize} * 8 - 1; @@ -153,7 +153,7 @@ is( scalar( uniqstr qw( a b c d a b e ) ), 5, 'uniqstr() in scalar context' ); } SKIP: { - skip('int overload requires perl version 5.8.0', 1) unless $] ge "5.008000"; + skip('int overload requires perl version 5.8.0', 1) unless "$]" >= 5.008000; package Googol; diff --git a/cpan/Scalar-List-Utils/t/uniqnum.t b/cpan/Scalar-List-Utils/t/uniqnum.t index ca218cd49e22..59aa854ee9c5 100644 --- a/cpan/Scalar-List-Utils/t/uniqnum.t +++ b/cpan/Scalar-List-Utils/t/uniqnum.t @@ -296,7 +296,7 @@ SKIP: { # uniqnum not confused by IV'ified floats SKIP: { # This fails on 5.6 and isn't fixable without breaking a lot of other tests - skip 'This perl version gets confused by IVNV dualvars', 1 if $] lt '5.008000'; + skip 'This perl version gets confused by IVNV dualvars', 1 if "$]" <= 5.008000; my @nums = ( 2.1, 2.2, 2.3 ); my $dummy = sprintf "%d", $_ for @nums; From aef568b32aae229df35c7471901f4647c6cca1b7 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:26:48 +0100 Subject: [PATCH 09/18] [Test-Harness] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; --- cpan/Test-Harness/lib/TAP/Harness.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpan/Test-Harness/lib/TAP/Harness.pm b/cpan/Test-Harness/lib/TAP/Harness.pm index 90f526dea52b..f25527d03df8 100644 --- a/cpan/Test-Harness/lib/TAP/Harness.pm +++ b/cpan/Test-Harness/lib/TAP/Harness.pm @@ -494,7 +494,7 @@ Any keys for which the value is C will be ignored. warn "CPAN::Meta::YAML required to process $rulesfile" ; return; } - my $layer = $] lt "5.008" ? "" : ":encoding(UTF-8)"; + my $layer = "$]" < 5.008 ? "" : ":encoding(UTF-8)"; open my $fh, "<$layer", $rulesfile or die "Couldn't open $rulesfile: $!"; my $yaml_text = do { local $/; <$fh> }; From ad1efdfec8f444d97a5e36a8285b48ba0551d1d5 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:26:48 +0100 Subject: [PATCH 10/18] [version] fix string comparisons with $] to use numeric comparison instead The fix follows Zefram's suggestion from https://www.nntp.perl.org/group/perl.perl5.porters/2012/05/msg186846.html > On older perls, however, $] had a numeric value that was built up using > floating-point arithmetic, such as 5+0.006+0.000002. This would not > necessarily match the conversion of the complete value from string form > [perl #72210]. You can work around that by explicitly stringifying > $] (which produces a correct string) and having *that* numify (to a > correctly-converted floating point value) for comparison. I cultivate > the habit of always stringifying $] to work around this, regardless of > the threshold where the bug was fixed. So I'd write > > use if "$]" >= 5.014, warnings => "non_unicode"; --- cpan/version/t/coretests.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpan/version/t/coretests.pm b/cpan/version/t/coretests.pm index 55725945c6e2..c6471bd530e5 100644 --- a/cpan/version/t/coretests.pm +++ b/cpan/version/t/coretests.pm @@ -348,7 +348,7 @@ SKIP: { SKIP: { skip 'Cannot test bare alpha v-strings with Perl < 5.8.1', 2 - if $] lt 5.008_001; + if "$]" < 5.008_001; $version = $CLASS->$method(v1.2.3_4); $DB::single = 1; is($version, "v1.2.34", '"$version" eq "v1.2.34"'); From 24b25abf3b674d14301750f1758f2d6c2b91d806 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 01:51:27 +0100 Subject: [PATCH 11/18] fix perl5db.pl to import the correct feature bundle --- lib/perl5db.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index fbb909449ff7..d2e93e5a92a0 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -523,7 +523,7 @@ package DB; BEGIN { require feature; - $^V =~ /^v(\d+\.\d+)/; + $^V =~ /^v(5\.\d+|\d+)/; feature->import(":$1"); $_initial_cwd = Cwd::getcwd(); } From 31e47f2ca2c3c39ec0c16f454edc75f688d37362 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 09:48:22 +0100 Subject: [PATCH 12/18] fix require tests: all versions up to 41.7 are valid --- t/comp/require.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/comp/require.t b/t/comp/require.t index aecacd74e191..5d83200541cc 100644 --- a/t/comp/require.t +++ b/t/comp/require.t @@ -86,7 +86,7 @@ print "# $@\nnot " if $@; print "ok ",$i++," - require v5 ignores sub named v5\n"; eval { require 10.0.2; }; -print "# $@\nnot " unless $@ =~ /^\QPerl v10.0.2 required\E/; +print "# $@\nnot " if $@; print "ok ",$i++," - require 10.0.2\n"; my $ver = 5.005_63; @@ -97,12 +97,12 @@ print "ok ",$i++," - require 5.005_63\n"; # check inaccurate fp $ver = 10.2; eval { require $ver; }; -print "# $@\nnot " unless $@ =~ /^\QPerl v10.200.0 required\E/; +print "# $@\nnot " if $@; print "ok ",$i++," - require 10.2\n"; $ver = 10.000_02; eval { require $ver; }; -print "# $@\nnot " unless $@ =~ /^\QPerl v10.0.20 required\E/; +print "# $@\nnot " if $@; print "ok ",$i++," - require 10.000_02\n"; print "not " unless 5.5.1 gt v5.5; From 7886c9dc95f2da9e084babbb4105d00566c817b3 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 11:40:45 +0100 Subject: [PATCH 13/18] fix use tests: all versions up to 41.7 are valid use-ing these versions will load the :5.41 bundle, since that's the highest one before them. This also means that we don't need to give hints about why 'use 5.6' or 'use 5.10' fail, because they won't anymore. --- pp_ctl.c | 43 +++++-------------------------------------- t/comp/use.t | 31 ++++++++++++++++++------------- 2 files changed, 23 insertions(+), 51 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index dbac02d86ecb..2947a4a2f3bf 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -4409,45 +4409,12 @@ S_require_version(pTHX_ SV *sv) } else { if ( vcmp(sv,PL_patchlevel) > 0 ) { - I32 first = 0; - AV *lav; SV * const req = SvRV(sv); - SV * const pv = *hv_fetchs(MUTABLE_HV(req), "original", FALSE); - - /* get the left hand term */ - lav = AV_FROM_REF(*hv_fetchs(MUTABLE_HV(req), "version", FALSE)); - - first = SvIV(*av_fetch(lav,0,0)); - if ( first > (int)PERL_REVISION /* probably 'use 6.0' */ - || hv_exists(MUTABLE_HV(req), "qv", 2 ) /* qv style */ - || av_count(lav) > 2 /* FP with > 3 digits */ - || strstr(SvPVX(pv),".0") /* FP with leading 0 */ - ) { - DIE(aTHX_ "Perl %" SVf " required--this is only " - "%" SVf ", stopped", - SVfARG(sv_2mortal(vnormal(req))), - SVfARG(sv_2mortal(vnormal(PL_patchlevel))) - ); - } - else { /* probably 'use 5.10' or 'use 5.8' */ - SV *hintsv; - I32 second = 0; - - if (av_count(lav) > 1) - second = SvIV(*av_fetch(lav,1,0)); - - second /= second >= 600 ? 100 : 10; - hintsv = Perl_newSVpvf(aTHX_ "v%d.%d.0", - (int)first, (int)second); - upg_version(hintsv, TRUE); - - DIE(aTHX_ "Perl %" SVf " required (did you mean %" SVf "?)" - "--this is only %" SVf ", stopped", - SVfARG(sv_2mortal(vnormal(req))), - SVfARG(sv_2mortal(vnormal(sv_2mortal(hintsv)))), - SVfARG(sv_2mortal(vnormal(PL_patchlevel))) - ); - } + DIE(aTHX_ "Perl %" SVf " required--this is only " + "%" SVf ", stopped", + SVfARG(sv_2mortal(vnormal(req))), + SVfARG(sv_2mortal(vnormal(PL_patchlevel))) + ); } } diff --git a/t/comp/use.t b/t/comp/use.t index 1fbc4a7b5a30..5f35f9cf8123 100644 --- a/t/comp/use.t +++ b/t/comp/use.t @@ -6,7 +6,7 @@ BEGIN { $INC{"feature.pm"} = 1; # so we don't attempt to load feature.pm } -print "1..87\n"; +print "1..88\n"; # Can't require test.pl, as we're testing the use/require mechanism here. @@ -87,7 +87,7 @@ eval q{ use v5.5.630; }; is ($@, ''); eval q{ use 10.0.2; }; -like ($@, qr/^\QPerl v10.0.2 required\E/); +is ($@, ''); eval "use 5.000"; # implicit semicolon is ($@, ''); @@ -96,41 +96,46 @@ eval "use 5.000;"; is ($@, ''); eval "use 6.000;"; -like ($@, qr/\QPerl v6.0.0 required--this is only $^V, stopped\E/); +is ($@, ''); eval "no 6.000;"; -is ($@, ''); +like ($@, qr/\QPerls since v6.0.0 too modern--this is $^V, stopped\E/); eval "no 5.000;"; like ($@, qr/\QPerls since v5.0.0 too modern--this is $^V, stopped\E/); eval "use 5.6;"; -like ($@, qr/\QPerl v5.600.0 required (did you mean v5.6.0?)--this is only $^V, stopped\E/); +is ($@, ''); eval "use 5.8;"; -like ($@, qr/\QPerl v5.800.0 required (did you mean v5.8.0?)--this is only $^V, stopped\E/); +is ($@, ''); eval "use 5.9;"; -like ($@, qr/\QPerl v5.900.0 required (did you mean v5.9.0?)--this is only $^V, stopped\E/); +is ($@, ''); eval "use 5.10;"; -like ($@, qr/\QPerl v5.100.0 required (did you mean v5.10.0?)--this is only $^V, stopped\E/); +is ($@, ''); eval "use 5.11;"; -like ($@, qr/\QPerl v5.110.0 required (did you mean v5.11.0?)--this is only $^V, stopped\E/); +is ($@, ''); eval sprintf "use %.6f;", $]; is ($@, ''); -eval sprintf "use %.6f;", $] - 0.000001; +eval sprintf "use %.6f;", $] - 0.001; is ($@, ''); +my $Vthis = int $]; +my $Vnext = $Vthis + 1; eval sprintf("use %.6f;", $] + 1); -like ($@, qr/Perl v6\.\d+\.\d+ required--this is only \Q$^V\E, stopped/a); +like ($@, qr/Perl v$Vnext\.\d+\.\d+ required--this is only \Q$^V\E, stopped/a); + +eval sprintf "use %.6f;", $] + 0.001; +like ($@, qr/Perl v$Vthis\.\d+\.\d+ required--this is only \Q$^V\E, stopped/a); -eval sprintf "use %.6f;", $] + 0.00001; -like ($@, qr/Perl v5\.\d+\.\d+ required--this is only \Q$^V\E, stopped/a); +eval sprintf "use %.3f;", $Vthis + .999; +like ($@, qr/Perl v$Vthis\.\d+\.\d+ required--this is only \Q$^V\E, stopped/a); # check that "use 5.11.0" (and higher) loads strictures eval 'use 5.11.0; ${"foo"} = "bar";'; From dbfe1223ce41e3133d00de902f1255a336970bf2 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 13:05:17 +0100 Subject: [PATCH 14/18] fix XS-APItest test about Perl API version --- ext/XS-APItest/t/xsub_h.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/XS-APItest/t/xsub_h.t b/ext/XS-APItest/t/xsub_h.t index a7e2541e425f..5fabfc1a7fb0 100644 --- a/ext/XS-APItest/t/xsub_h.t +++ b/ext/XS-APItest/t/xsub_h.t @@ -117,7 +117,7 @@ foreach $XS_VERSION (undef, @versions) { is_deeply([XS_APIVERSION_valid("Pie")], [], "XS_APIVERSION_BOOTCHECK passes"); is(eval {XS_APIVERSION_invalid("Pie"); 1}, undef, "XS_APIVERSION_BOOTCHECK croaks for an invalid version"); -like($@, qr/Perl API version v1.0.16 of Pie does not match v5\.\d+\.\d+/, +like($@, qr/Perl API version v1.0.16 of Pie does not match v(?:5\.\d+\.\d+|\d+\.\d+) /, "expected error"); my @xsreturn; From 0397ab8b8d727f9d9885018f07ff3cbd0bcd00fd Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 22:27:12 +0100 Subject: [PATCH 15/18] fix B::Deparse tests --- lib/B/Deparse-core.t | 5 +++-- lib/B/Deparse.t | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/B/Deparse-core.t b/lib/B/Deparse-core.t index 2f8bedecc734..043bc6e86a38 100644 --- a/lib/B/Deparse-core.t +++ b/lib/B/Deparse-core.t @@ -38,8 +38,9 @@ use warnings; use strict; use Test::More; -use feature (sprintf(":%vd", $^V)); # to avoid relying on the feature - # logic to add CORE:: +# to avoid relying on the feature logic to add CORE:: +use feature (sprintf(":%s", $^V =~ /^v(5\.\d+|\d+)/g)); + use B::Deparse; my $deparse = B::Deparse->new(); diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 6e6526a286b0..3d20a84cd060 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1645,7 +1645,7 @@ CORE::evalbytes ''; #### # feature features when feature has been disabled by use VERSION # CONTEXT no warnings 'deprecated'; -use feature (sprintf(":%vd", $^V)); +use feature (sprintf(":%s", $^V =~ /^v(5\.\d+|\d+)/g)); use 1; CORE::say $_; CORE::state $x; @@ -1660,7 +1660,7 @@ CORE::evalbytes ''; # (the above test with CONTEXT, and the output is equivalent but different) # CONTEXT use feature ':5.10'; no warnings 'deprecated'; # feature features when feature has been disabled by use VERSION -use feature (sprintf(":%vd", $^V)); +use feature (sprintf(":%s", $^V =~ /^v(5\.\d+|\d+)/g)); use 1; CORE::say $_; CORE::state $x; From 05a12918ee8b790b8d9402ed7ca5bef2b071515c Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 12 Dec 2024 23:06:10 +0100 Subject: [PATCH 16/18] update fatal deprecation messages with the new version scheme --- op.c | 2 +- pp_ctl.c | 2 +- t/lib/feature/implicit | 6 +++--- t/lib/warnings/op | 4 ++-- t/lib/warnings/pp_ctl | 2 +- t/op/goto.t | 2 +- t/porting/deprecation.t | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/op.c b/op.c index 1b5c11c58bc1..0cb664dc29d0 100644 --- a/op.c +++ b/op.c @@ -8287,7 +8287,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg) } else { /* OK let's at least warn */ - deprecate_fatal_in(WARN_DEPRECATED__SUBSEQUENT_USE_VERSION, "5.44", + deprecate_fatal_in(WARN_DEPRECATED__SUBSEQUENT_USE_VERSION, "44", "Changing use VERSION while another use VERSION is in scope"); } } diff --git a/pp_ctl.c b/pp_ctl.c index 2947a4a2f3bf..2112f1070ff3 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3585,7 +3585,7 @@ PP(pp_goto) : 1; if (enterops[i]) deprecate_fatal_in(WARN_DEPRECATED__GOTO_CONSTRUCT, - "5.42", + "42", "Use of \"goto\" to jump into a construct"); } diff --git a/t/lib/feature/implicit b/t/lib/feature/implicit index d8e186af2648..c11ad9bbd081 100644 --- a/t/lib/feature/implicit +++ b/t/lib/feature/implicit @@ -69,7 +69,7 @@ evalbytes "say 'yes'"; use 5.014; evalbytes; EXPECT -Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 5.44 at - line 8. +Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 44 at - line 8. say sub yes evalbytes sub @@ -81,7 +81,7 @@ print 'ss' =~ /$sharp_s/i ? "ok\n" : "nok\n"; use v5.14; print 'ss' =~ /$sharp_s/i ? "ok\n" : "nok\n"; EXPECT -Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 5.44 at - line 5. +Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 44 at - line 5. nok ok ######## @@ -93,6 +93,6 @@ print eval "use utf8; q|$long_s|" eq "\x{17f}" ? "ok\n" : "nok\n"; use v5.15; print eval "use utf8; q|$long_s|" eq $long_s ? "ok\n" : "nok\n"; EXPECT -Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 5.44 at - line 6. +Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 44 at - line 6. ok ok diff --git a/t/lib/warnings/op b/t/lib/warnings/op index cf067d9e5378..2d3207a68d19 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -2249,7 +2249,7 @@ use warnings; use v5.12; use v5.20; EXPECT -Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 5.44 at - line 3. +Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 44 at - line 3. ######## use warnings; use v5.8; @@ -2260,7 +2260,7 @@ use warnings; use v5.10; use v5.8; EXPECT -Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 5.44 at - line 3. +Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 44 at - line 3. ######## use warnings; use v5.12; diff --git a/t/lib/warnings/pp_ctl b/t/lib/warnings/pp_ctl index c67f7fe9471d..ed3ef7d1fddc 100644 --- a/t/lib/warnings/pp_ctl +++ b/t/lib/warnings/pp_ctl @@ -251,7 +251,7 @@ EXPECT use warnings; eval 'use 5.012; use 5.14.0'; EXPECT -Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 5.44 at (eval 1) line 1. +Changing use VERSION while another use VERSION is in scope is deprecated, and will become fatal in Perl 44 at (eval 1) line 1. ######## # SKIP ? !$Config{default_inc_includes_dot} # NAME check warning for do with no . in @INC diff --git a/t/op/goto.t b/t/op/goto.t index c2a16fe7d1b1..0c2090f9c95e 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -18,7 +18,7 @@ our $TODO; my $deprecated = 0; local $SIG{__WARN__} = sub { - if ($_[0] =~ m/jump into a construct.*?, and will become fatal in Perl 5\.42/) { + if ($_[0] =~ m/jump into a construct.*?, and will become fatal in Perl 42/) { $deprecated++; } else { warn $_[0] } diff --git a/t/porting/deprecation.t b/t/porting/deprecation.t index 67f759e5c6c1..044c98d7a0c1 100644 --- a/t/porting/deprecation.t +++ b/t/porting/deprecation.t @@ -103,7 +103,7 @@ if (-e ".git") { goto LABEL; DONE: like($warning, - qr/Use of "goto" to jump into a construct is deprecated, and will become fatal in Perl 5\.42/, + qr/Use of "goto" to jump into a construct is deprecated, and will become fatal in Perl 42/, "Got expected deprecation warning"); } # Test that we can silence deprecation warnings with "no warnings 'deprecated'" From 75941c336b154303224839940e84eece211d6c2a Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Thu, 19 Dec 2024 10:06:20 +0100 Subject: [PATCH 17/18] fix perl_version in regen/regen_lib.pl --- regen/regen_lib.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regen/regen_lib.pl b/regen/regen_lib.pl index a14ec4e01f56..9933d3df226f 100644 --- a/regen/regen_lib.pl +++ b/regen/regen_lib.pl @@ -377,7 +377,7 @@ sub perl_version { die "can't locate PERL_REVISION in '$plh'" unless defined $v1; die "can't locate PERL_VERSION in '$plh'" unless defined $v2; die "can't locate PERL_SUBVERSION in '$plh'" unless defined $v3; - return ($v1,$v2,$v3, sprintf("%d.%03d%03d", $v1, $v2, $v3)); + return ($v2,$v3, 0, sprintf("%d.%03d%03d", $v2, $v3, 0)); } From cfb495afe308e9d46567343b0dafbf210d7e806d Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK)" Date: Tue, 17 Dec 2024 00:59:30 +0100 Subject: [PATCH 18/18] fix Module-CoreList to support versions larger than 5 Important fixes include: * sorting numerical versions using <=> * properly computing the family for versions larger than 5 --- dist/Module-CoreList/lib/Module/CoreList.pm | 20 +++++++++---------- .../lib/Module/CoreList/Utils.pm | 10 +++++----- lib/B/Op_private.pm | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm index a31888f8952f..bd2c7191915f 100644 --- a/dist/Module-CoreList/lib/Module/CoreList.pm +++ b/dist/Module-CoreList/lib/Module/CoreList.pm @@ -12,7 +12,7 @@ sub _looks_like_invocant ($) { local $@; !!eval { $_[0]->isa(__PACKAGE__) } } sub _undelta { my ($delta) = @_; my (%expanded, $delta_from, $base, $changed, $removed); - for my $v (sort keys %$delta) { + for my $v (sort { $a <=> $b } keys %$delta) { ($delta_from, $changed, $removed) = @{$delta->{$v}}{qw( delta_from changed removed )}; $base = $delta_from ? $expanded{$delta_from} : {}; my %full = ( %$base, %{$changed || {}} ); @@ -54,7 +54,7 @@ sub first_release_raw { my @perls = $version ? grep { defined $version{$_}{ $module } && - $version{$_}{ $module } ge $version } keys %version + $version{$_}{ $module } >= $version } keys %version : grep { exists $version{$_}{ $module } } keys %version; return @perls; @@ -69,7 +69,7 @@ sub first_release_by_date { sub first_release { my @perls = &first_release_raw; return unless @perls; - return (sort { $a cmp $b } @perls)[0]; + return (sort { $a <=> $b } @perls)[0]; } sub find_modules { @@ -123,9 +123,9 @@ sub removed_from_by_date { sub removed_raw { shift if defined $_[1] and $_[1] =~ PKG_PATTERN and _looks_like_invocant $_[0]; my $mod = shift; - return unless my @perls = sort { $a cmp $b } first_release_raw($mod); + return unless my @perls = sort { $a <=> $b } first_release_raw($mod); my $last = pop @perls; - my @removed = grep { $_ > $last } sort { $a cmp $b } keys %version; + my @removed = grep { $_ > $last } sort { $a <=> $b } keys %version; return @removed; } @@ -431,11 +431,11 @@ sub changes_between { 5.041005 => '2024-10-20', 5.041006 => '2024-11-20', 5.041007 => '2024-12-20', - 5.041008 => '2025-01-20', + 41.008 => '2025-01-20', ); for my $version ( sort { $a <=> $b } keys %released ) { - my $family = int ($version * 1000) / 1000; + my $family = $version > 41 ? int($version) : int( $version * 1000 ) / 1000; push @{ $families{ $family }} , $version; } @@ -22499,11 +22499,11 @@ for my $version ( sort { $a <=> $b } keys %released ) { removed => { } }, - 5.041008 => { + 41.008 => { delta_from => 5.041007, changed => { - 'B::Op_private' => '5.041008', - 'Config' => '5.041008', + 'B::Op_private' => '41.008000', + 'Config' => '41.008000', 'Module::CoreList' => '5.20250120', 'Module::CoreList::Utils'=> '5.20250120', }, diff --git a/dist/Module-CoreList/lib/Module/CoreList/Utils.pm b/dist/Module-CoreList/lib/Module/CoreList/Utils.pm index b236aaf39c9b..52b3f9a38b75 100644 --- a/dist/Module-CoreList/lib/Module/CoreList/Utils.pm +++ b/dist/Module-CoreList/lib/Module/CoreList/Utils.pm @@ -32,7 +32,7 @@ sub first_release_raw { my @perls = $version ? grep { exists $utilities{$_}{ $util } && - $utilities{$_}{ $util } ge $version } keys %utilities + $utilities{$_}{ $util } >= $version } keys %utilities : grep { exists $utilities{$_}{ $util } } keys %utilities; return grep { exists $Module::CoreList::released{$_} } @perls; @@ -47,7 +47,7 @@ sub first_release_by_date { sub first_release { my @perls = &first_release_raw; return unless @perls; - return (sort { $a cmp $b } @perls)[0]; + return (sort { $a <=> $b } @perls)[0]; } sub removed_from { @@ -63,10 +63,10 @@ sub removed_from_by_date { sub removed_raw { my $util = shift; $util = shift if eval { $util->isa(__PACKAGE__) }; - return unless my @perls = sort { $a cmp $b } first_release_raw($util); + return unless my @perls = sort { $a <=> $b } first_release_raw($util); @perls = grep { exists $Module::CoreList::released{$_} } @perls; my $last = pop @perls; - my @removed = grep { $_ > $last } sort { $a cmp $b } keys %utilities; + my @removed = grep { $_ > $last } sort { $a <=> $b } keys %utilities; return @removed; } @@ -2077,7 +2077,7 @@ my %delta = ( removed => { } }, - 5.041008 => { + 41.008 => { delta_from => 5.041007, changed => { }, diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index 7239cad86cc5..2a9c4c36cb0e 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -118,7 +118,7 @@ package B::Op_private; our %bits; -our $VERSION = "5.041008"; +our $VERSION = "41.008000"; $bits{$_}{3} = 'OPpENTERSUB_AMPER' for qw(entersub rv2cv); $bits{$_}{6} = 'OPpENTERSUB_DB' for qw(entersub rv2cv);