Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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"; This ensures that the comparisons will still work when Perl's major version changes to anything greater than 9. diff --git a/cpan/CPAN-Meta-Requirements/t/from-hash.t b/cpan/CPAN-Meta-Requirements/t/from-hash.t index 400b846d6b..55f4aaaff2 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, diff --git a/cpan/CPAN-Meta-YAML/t/01_compile.t b/cpan/CPAN-Meta-YAML/t/01_compile.t index 916c6ce2bd..ff5a117096 100644 --- a/cpan/CPAN-Meta-YAML/t/01_compile.t +++ b/cpan/CPAN-Meta-YAML/t/01_compile.t @@ -11,7 +11,7 @@ BEGIN { use Test::More 0.88; # Check their perl version -ok( $] ge '5.008001', "Your perl is new enough" ); +ok( "$]" >= '5.008001', "Your perl is new enough" ); # Does the module load require_ok( 'CPAN::Meta::YAML' ); diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta.pm b/cpan/CPAN-Meta/lib/CPAN/Meta.pm index 4a8e65c0fc..e06bb247eb 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'" diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm index 6ce4e044bb..578c0d49c6 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/); } diff --git a/cpan/Pod-Simple/lib/Pod/Simple.pm b/cpan/Pod-Simple/lib/Pod/Simple.pm index 9e521ad274..34cc19907c 100644 --- a/cpan/Pod-Simple/lib/Pod/Simple.pm +++ b/cpan/Pod-Simple/lib/Pod/Simple.pm @@ -33,7 +33,7 @@ BEGIN { die "MANY_LINES is too small (", MANY_LINES(), ")!\nAborting"; } if(defined &UNICODE) { } - elsif($] >= 5.008) { *UNICODE = sub() {1} } + elsif("$]" >= 5.008) { *UNICODE = sub() {1} } else { *UNICODE = sub() {''} } } if(DEBUG > 2) { @@ -42,7 +42,7 @@ 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 +if ("$]" >= 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 242a4eb117..6a2b143181 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 = ("$]" <= 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 (("$]" >= 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<foo> 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 "$]" <= 5.006_000; # No UTF-8 on very early perls my $copy; no warnings 'utf8'; - if ($] ge 5.007_003) { + if ("$]" >= 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 "$]" <= 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 3205f90d46..0d74509bac 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 04659fea0b..cf8982f76d 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 e5f0e2c79a..9fab8b507d 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 "$]" >= 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 e45b47e550..acfebb34ff 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 3b453f12be..b178ea780a 100644 --- a/cpan/Pod-Simple/t/ascii_order.pl +++ b/cpan/Pod-Simple/t/ascii_order.pl @@ -5,7 +5,7 @@ sub native_to_uni($) { # Convert from platform character set to Unicode 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 2219e8c05f..78df12c550 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 = '—'; diff --git a/cpan/Scalar-List-Utils/t/stack-corruption.t b/cpan/Scalar-List-Utils/t/stack-corruption.t index 03f141af68..9f92bcb191 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 5247a37b00..7bae642c73 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 d296aa8d57..8ed7516bf3 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 ca218cd49e..31a883d218 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; diff --git a/cpan/Test-Harness/lib/TAP/Harness.pm b/cpan/Test-Harness/lib/TAP/Harness.pm index 90f526dea5..ae09e96928 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<undef> 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> }; diff --git a/cpan/Test-Simple/lib/Test2/API.pm b/cpan/Test-Simple/lib/Test2/API.pm index 65727dfd38..c56181e403 100644 --- a/cpan/Test-Simple/lib/Test2/API.pm +++ b/cpan/Test-Simple/lib/Test2/API.pm @@ -74,7 +74,7 @@ sub CLONE { BEGIN { no warnings 'once'; - if($] ge '5.014' || $ENV{T2_CHECK_DEPTH} || $Test2::API::DO_DEPTH_CHECK) { + if("$]" >= '5.014' || $ENV{T2_CHECK_DEPTH} || $Test2::API::DO_DEPTH_CHECK) { *DO_DEPTH_CHECK = sub() { 1 }; } else { diff --git a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm index f8536ae4fa..67ac2442d2 100644 --- a/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm +++ b/cpan/Test-Simple/lib/Test2/Formatter/TAP.pm @@ -66,7 +66,7 @@ sub _open_handles { sub encoding { my $self = shift; - if ($] ge "5.007003" and @_) { + if ("$]" >= "5.007003" and @_) { my ($enc) = @_; my $handles = $self->{+HANDLES}; diff --git a/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm b/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm index 67ca98e3a4..43a14d0e03 100644 --- a/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm +++ b/cpan/Test-Simple/lib/Test2/Tools/Tiny.pm @@ -3,7 +3,7 @@ use strict; use warnings; BEGIN { - if ($] lt "5.008") { + if ("$]" < "5.008") { require Test::Builder::IO::Scalar; } } @@ -260,7 +260,7 @@ sub capture(&) { ($ok, $e) = try { # Scalar refs as filehandles were added in 5.8. - if ($] ge "5.008") { + if ("$]" >= "5.008") { open($out_fh, '>', \$out) or die "Failed to open a temporary STDOUT: $!"; open($err_fh, '>', \$err) or die "Failed to open a temporary STDERR: $!"; } diff --git a/cpan/Test-Simple/t/HashBase.t b/cpan/Test-Simple/t/HashBase.t index e040de6e36..70274ebd9f 100644 --- a/cpan/Test-Simple/t/HashBase.t +++ b/cpan/Test-Simple/t/HashBase.t @@ -84,7 +84,7 @@ is($pkg->do_it, 'const', "worked as expected"); } ok(!$pkg->FOO, "overrode const sub"); { -local $TODO = "known to fail on $]" if $] le "5.006002"; +local $TODO = "known to fail on $]" if "$]" <= "5.006002"; is($pkg->do_it, 'const', "worked as expected, const was constant"); } diff --git a/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t b/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t index d0f194c0b9..740a640194 100644 --- a/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t +++ b/cpan/Test-Simple/t/Legacy/Regression/736_use_ok.t @@ -19,7 +19,7 @@ sub capture(&) { } { -local $TODO = "known to fail on $]" if $] le "5.006002"; +local $TODO = "known to fail on $]" if "$]" <= "5.006002"; my $file = __FILE__; my $line = __LINE__ + 4; like( diff --git a/cpan/Test-Simple/t/Legacy/overload_threads.t b/cpan/Test-Simple/t/Legacy/overload_threads.t index fbc067aea1..1c57530241 100644 --- a/cpan/Test-Simple/t/Legacy/overload_threads.t +++ b/cpan/Test-Simple/t/Legacy/overload_threads.t @@ -20,7 +20,7 @@ BEGIN { use Test::More; -plan skip_all => "known to crash on $]" if $] le "5.006002"; +plan skip_all => "known to crash on $]" if "$]" <= "5.006002"; plan tests => 5; diff --git a/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t b/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t index b5cf68be71..c1e60b1ee0 100644 --- a/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t +++ b/cpan/Test-Simple/t/Legacy_And_Test2/preload_diag_note.t @@ -1,7 +1,7 @@ use strict; use warnings; -if ($] lt "5.008") { +if ("$]" < "5.008") { print "1..0 # SKIP Test cannot run on perls below 5.8.0\n"; exit 0; } diff --git a/cpan/Test-Simple/t/Test2/behavior/init_croak.t b/cpan/Test-Simple/t/Test2/behavior/init_croak.t index bebf410b82..de3bbc41f2 100644 --- a/cpan/Test-Simple/t/Test2/behavior/init_croak.t +++ b/cpan/Test-Simple/t/Test2/behavior/init_croak.t @@ -14,7 +14,7 @@ BEGIN { } } -skip_all("known to fail on $]") if $] le "5.006002"; +skip_all("known to fail on $]") if "$]" <= "5.006002"; $@ = ""; my ($file, $line) = (__FILE__, __LINE__ + 1); diff --git a/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t b/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t index 0c79c8a854..6fee206fdd 100644 --- a/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t +++ b/cpan/Test-Simple/t/Test2/behavior/nested_context_exception.t @@ -5,7 +5,7 @@ use Test2::Tools::Tiny; use Test2::API qw/context/; -skip_all("known to fail on $]") if $] le "5.006002"; +skip_all("known to fail on $]") if "$]" <= "5.006002"; sub outer { my $code = shift; diff --git a/cpan/Test-Simple/t/Test2/modules/API.t b/cpan/Test-Simple/t/Test2/modules/API.t index c96c423a43..763d2d0625 100644 --- a/cpan/Test-Simple/t/Test2/modules/API.t +++ b/cpan/Test-Simple/t/Test2/modules/API.t @@ -114,7 +114,7 @@ like( "got warning about adding driver too late" ); }; -if ($] le "5.006002") { +if ("$]" <= "5.006002") { todo("TODO known to fail on $]", $sub1); } else { $sub1->(); diff --git a/cpan/Test-Simple/t/Test2/modules/API/Breakage.t b/cpan/Test-Simple/t/Test2/modules/API/Breakage.t index 0ceeeab906..673b29cf07 100644 --- a/cpan/Test-Simple/t/Test2/modules/API/Breakage.t +++ b/cpan/Test-Simple/t/Test2/modules/API/Breakage.t @@ -1,7 +1,7 @@ use strict; use warnings; -if ($] lt "5.008") { +if ("$]" < "5.008") { print "1..0 # SKIP Test cannot run on perls below 5.8.0 because local doesn't work on hash keys.\n"; exit 0; } diff --git a/cpan/Test-Simple/t/Test2/modules/API/Instance.t b/cpan/Test-Simple/t/Test2/modules/API/Instance.t index 9923c501da..60aa1b239d 100644 --- a/cpan/Test-Simple/t/Test2/modules/API/Instance.t +++ b/cpan/Test-Simple/t/Test2/modules/API/Instance.t @@ -211,7 +211,7 @@ if (CAN_REALLY_FORK) { like($warnings[0], qr/Process .* did not exit cleanly \(wstat: \S+, exit: 0, sig: 15\)/, "Warn about exit"); } -if (CAN_THREAD && $] ge '5.010') { +if (CAN_THREAD && "$]" >= '5.010') { require threads; my $one = $CLASS->new; @@ -297,7 +297,7 @@ if (CAN_THREAD && $] ge '5.010') { } SKIP: { - last SKIP if $] lt "5.008"; + last SKIP if "$]" < "5.008"; my $one = $CLASS->new; my $stderr = ""; { @@ -326,7 +326,7 @@ This is not a supported configuration, you will have problems. } SKIP: { - last SKIP if $] lt "5.008"; + last SKIP if "$]" < "5.008"; require Test2::API::Breakage; no warnings qw/redefine once/; my $ran = 0; diff --git a/cpan/Test-Simple/t/Test2/modules/Hub.t b/cpan/Test-Simple/t/Test2/modules/Hub.t index 50e1497ed2..ab2633cbd7 100644 --- a/cpan/Test-Simple/t/Test2/modules/Hub.t +++ b/cpan/Test-Simple/t/Test2/modules/Hub.t @@ -141,7 +141,7 @@ tests IPC => sub { } } - if (CAN_THREAD && $] ge '5.010') { + if (CAN_THREAD && "$]" >= '5.010') { require threads; my $thr = threads->new(sub { $do_send->() }); $thr->join; diff --git a/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t b/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t index d5ebbd5fd2..30eec056b4 100644 --- a/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t +++ b/cpan/Test-Simple/t/Test2/modules/IPC/Driver.t @@ -26,7 +26,7 @@ for my $meth (qw/send cull add_hub drop_hub waiting is_viable/) { } SKIP: { - last SKIP if $] lt "5.008"; + last SKIP if "$]" < "5.008"; tests abort => sub { my $one = Test2::IPC::Driver->new(no_fatal => 1); my ($err, $out) = ("", ""); diff --git a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t index cf7d5622d0..a764384721 100644 --- a/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t +++ b/cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t @@ -6,7 +6,7 @@ use List::Util qw/shuffle/; use strict; use warnings; -if ($] lt "5.008") { +if ("$]" < "5.008") { print "1..0 # SKIP Test cannot run on perls below 5.8.0\n"; exit 0; } diff --git a/cpan/Test-Simple/t/Test2/modules/Util.t b/cpan/Test-Simple/t/Test2/modules/Util.t index efbfd08dd7..e66afc1216 100644 --- a/cpan/Test-Simple/t/Test2/modules/Util.t +++ b/cpan/Test-Simple/t/Test2/modules/Util.t @@ -34,7 +34,7 @@ use Test2::Util qw/ /; BEGIN { - if ($] lt "5.008") { + if ("$]" < "5.008") { require Test::Builder::IO::Scalar; } } @@ -83,7 +83,7 @@ close($io); my $fh; my $out = ''; -if ($] ge "5.008") { +if ("$]" >= "5.008") { open($fh, '>', \$out) or die "Could not open filehandle"; } else { $fh = Test::Builder::IO::Scalar->new(\$out) or die "Could not open filehandle"; diff --git a/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t b/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t index 5550f1774b..c5ba5eeac0 100644 --- a/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t +++ b/cpan/Test-Simple/t/Test2/regression/ipc_files_abort_exit.t @@ -6,7 +6,7 @@ use Test2::Util qw/CAN_REALLY_FORK/; BEGIN { skip_all "Set AUTHOR_TESTING to run this test" unless $ENV{AUTHOR_TESTING}; skip_all "System cannot fork" unless CAN_REALLY_FORK; - skip_all "known to fail on $]" if $] le "5.006002"; + skip_all "known to fail on $]" if "$]" <= "5.006002"; } use IPC::Open3 qw/open3/; diff --git a/cpan/parent/t/parent-pmc.t b/cpan/parent/t/parent-pmc.t index db84b2f28b..3f74d25400 100644 --- a/cpan/parent/t/parent-pmc.t +++ b/cpan/parent/t/parent-pmc.t @@ -17,7 +17,7 @@ plan skip_all => ".pmc are only available with 5.6 and later" if $] < 5.006; # Skip this test if perl is compiled with PERL_DISABLE_PMC # my $pmc = 1; -if (Config->can('non_bincompat_options')) { # $] ge '5.014' +if (Config->can('non_bincompat_options')) { # "$]" >= '5.014' $pmc = 0 if grep { $_ eq 'PERL_DISABLE_PMC' } Config::non_bincompat_options(); } elsif (eval { diff --git a/cpan/version/t/coretests.pm b/cpan/version/t/coretests.pm index 55725945c6..c6471bd530 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"'); diff --git a/dist/Attribute-Handlers/lib/Attribute/Handlers.pm b/dist/Attribute-Handlers/lib/Attribute/Handlers.pm index 861ea2f8d5..c1900d2674 100644 --- a/dist/Attribute-Handlers/lib/Attribute/Handlers.pm +++ b/dist/Attribute-Handlers/lib/Attribute/Handlers.pm @@ -167,7 +167,7 @@ sub AUTOLOAD { croak "Attribute handler '$2' doesn't handle $1 attributes"; } -my $builtin = $] ge '5.027000' +my $builtin = "$]" >= '5.027000' ? qr/lvalue|method|shared/ : qr/lvalue|method|locked|shared|unique/; diff --git a/dist/Carp/t/arg_regexp.t b/dist/Carp/t/arg_regexp.t index 83e8f0359f..70e2c00200 100644 --- a/dist/Carp/t/arg_regexp.t +++ b/dist/Carp/t/arg_regexp.t @@ -13,7 +13,7 @@ sub rx { qr/$_[0]/ } # Use full generality on sufficiently recent versions. On early Perl # releases, U+E9 is 0x51 on all EBCDIC code pages supported then. -my $e9 = sprintf "%02x", (($] ge 5.007_003) +my $e9 = sprintf "%02x", (("$]" >= 5.007_003) ? utf8::unicode_to_native(0xe9) : ((ord("A") == 193) ? 0x51 diff --git a/dist/Carp/t/arg_string.t b/dist/Carp/t/arg_string.t index 544a4fe059..3a201af85d 100644 --- a/dist/Carp/t/arg_string.t +++ b/dist/Carp/t/arg_string.t @@ -12,7 +12,7 @@ sub lm { lmm() } # Use full generality on sufficiently recent versions. On early Perl # releases, U+E9 is 0x51 on all EBCDIC code pages supported then. -my $e9 = sprintf "%02x", (($] ge 5.007_003) +my $e9 = sprintf "%02x", (("$]" >= 5.007_003) ? utf8::unicode_to_native(0xe9) : ((ord("A") == 193) ? 0x51 diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index 5c24e84fa4..45cb1da803 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -17,7 +17,7 @@ use warnings; use 5.008_001; require Exporter; -use constant IS_PRE_516_PERL => $] < 5.016; +use constant IS_PRE_516_PERL => "$]" < 5.016; use constant SUPPORTS_CORE_BOOLS => defined &builtin::is_bool; use Carp (); @@ -210,7 +210,7 @@ sub Dump { return &Dumpxs unless $Data::Dumper::Useperl || (ref($_[0]) && $_[0]->{useperl}) # Use pure perl version on earlier releases on EBCDIC platforms - || (! $IS_ASCII && $] lt 5.021_010); + || (! $IS_ASCII && "$]" < 5.021_010); return &Dumpperl; } diff --git a/dist/Data-Dumper/t/dumper.t b/dist/Data-Dumper/t/dumper.t index 55a997c0b1..19aa376359 100644 --- a/dist/Data-Dumper/t/dumper.t +++ b/dist/Data-Dumper/t/dumper.t @@ -1670,7 +1670,7 @@ EOW { # [github #18614 - handling of Unicode characters in regexes] # [github #18764 - ... without breaking subsequent Latin-1] - if ($] lt '5.010') { + if ("$]" < '5.010') { SKIP_BOTH("Incomplete support for UTF-8 in old perls"); last; } @@ -1683,11 +1683,11 @@ EOW # '\xb6' #]; EOW - if ($] lt '5.010001') { + if ("$]" < '5.010001') { $want =~ s!qr/!qr/(?-xism:!g; $want =~ s!/,!)/,!g; } - elsif ($] gt '5.014') { + elsif ("$]" > '5.014') { $want =~ s{/(,?)$}{/u$1}mg; } my $want_xs = $want; @@ -1713,7 +1713,7 @@ EOW # qr/ $bs$bs$bs\\/ / #]; EOW - if ($] lt '5.010001') { + if ("$]" < '5.010001') { $want =~ s!qr/!qr/(?-xism:!g; $want =~ s! /! )/!g; } @@ -1724,7 +1724,7 @@ EOW ############# { # [github #18614, github #18764, perl #58608 corner cases] - if ($] lt '5.010') { + if ("$]" < '5.010') { SKIP_BOTH("Incomplete support for UTF-8 in old perls"); last; } @@ -1738,11 +1738,11 @@ EOW # '\xB6' #]; EOW - if ($] lt '5.010001') { + if ("$]" < '5.010001') { $want =~ s!qr/!qr/(?-xism:!g; $want =~ s!/,!)/,!g; } - elsif ($] gt '5.014') { + elsif ("$]" > '5.014') { $want =~ s{/(,?)$}{/u$1}mg; } my $want_xs = $want; @@ -1772,10 +1772,10 @@ EOW # '\xB6' #]; EOW - if ($] lt '5.014') { + if ("$]" < '5.014') { $want =~ s{/u,$}{/,}mg; } - if ($] lt '5.010001') { + if ("$]" < '5.010001') { $want =~ s!qr/!qr/(?-xism:!g; $want =~ s!/,!)/,!g; } diff --git a/dist/Devel-PPPort/t/testutil.pl b/dist/Devel-PPPort/t/testutil.pl index 981b659b3c..3c5d336ef1 100644 --- a/dist/Devel-PPPort/t/testutil.pl +++ b/dist/Devel-PPPort/t/testutil.pl @@ -29,7 +29,7 @@ my $noplan; # perls the burden of avoiding warnings becomes too large, and someone still # trying to use such outmoded versions should be willing to accept warnings in # our test suite. -$SIG{__WARN__} = sub { die "Fatalized: $_[0]" } if $] ge "5.6.0"; +$SIG{__WARN__} = sub { die "Fatalized: $_[0]" } if "$]" >= "5.6.0"; # This defines ASCII/UTF-8 vs EBCDIC/UTF-EBCDIC $::IS_ASCII = ord 'A' == 65; diff --git a/dist/Dumpvalue/lib/Dumpvalue.pm b/dist/Dumpvalue/lib/Dumpvalue.pm index 5a0d58ade7..f68b5af965 100644 --- a/dist/Dumpvalue/lib/Dumpvalue.pm +++ b/dist/Dumpvalue/lib/Dumpvalue.pm @@ -9,7 +9,7 @@ sub ASCII { return ord('A') == 65; } # This module will give incorrect results for some inputs on EBCDIC platforms # before v5.8 -*to_native = ($] lt "5.008") +*to_native = ("$]" < "5.008") ? sub { return shift } : sub { return utf8::unicode_to_native(shift) }; diff --git a/dist/Search-Dict/Makefile.PL b/dist/Search-Dict/Makefile.PL index 51a10b7acd..951d0a1062 100644 --- a/dist/Search-Dict/Makefile.PL +++ b/dist/Search-Dict/Makefile.PL @@ -15,7 +15,7 @@ my %WriteMakefileArgs = ( "Test::More" => 0.47, "Tie::Handle" => 0, }, - INSTALLDIRS => ( $] lt '5.012' ? 'perl' : 'site' ), + INSTALLDIRS => ( "$]" < '5.012' ? 'perl' : 'site' ), ); WriteMakefile(%WriteMakefileArgs); diff --git a/dist/Search-Dict/lib/Search/Dict.pm b/dist/Search-Dict/lib/Search/Dict.pm index f34d2220e5..56dc8e6634 100644 --- a/dist/Search-Dict/lib/Search/Dict.pm +++ b/dist/Search-Dict/lib/Search/Dict.pm @@ -5,7 +5,7 @@ require Exporter; my $fc_available; BEGIN { $fc_available = '5.015008'; - if ( $] ge $fc_available ) { + if ( "$]" >= $fc_available ) { require feature; 'feature'->import('fc'); # string avoids warning on old Perls <sigh> } @@ -80,7 +80,7 @@ sub look { $blksize ||= 8192; $key =~ s/[^\w\s]//g if $dict; if ( $fold ) { - $key = $] ge $fc_available ? fc($key) : lc($key); + $key = "$]" >= $fc_available ? fc($key) : lc($key); } # find the right block my($min, $max) = (0, int($size / $blksize)); @@ -95,7 +95,7 @@ sub look { chomp; s/[^\w\s]//g if $dict; if ( $fold ) { - $_ = $] ge $fc_available ? fc($_) : lc($_); + $_ = "$]" >= $fc_available ? fc($_) : lc($_); } if (defined($_) && $comp->($_, $key) < 0) { $min = $mid; @@ -117,7 +117,7 @@ sub look { chomp; s/[^\w\s]//g if $dict; if ( $fold ) { - $_ = $] ge $fc_available ? fc($_) : lc($_); + $_ = "$]" >= $fc_available ? fc($_) : lc($_); } last if $comp->($_, $key) >= 0; } diff --git a/dist/Search-Dict/t/Dict.t b/dist/Search-Dict/t/Dict.t index 21b226e09c..7488f5ea27 100644 --- a/dist/Search-Dict/t/Dict.t +++ b/dist/Search-Dict/t/Dict.t @@ -2,7 +2,7 @@ use strict; use Test::More; -plan tests => ( $] ge '5.008' ? 14 : 10 ); +plan tests => ( "$]" >= '5.008' ? 14 : 10 ); my $DICT = <<EOT; Aarhus @@ -103,7 +103,7 @@ close DICT or die "cannot close"; } unlink "dict-$$"; -if ( $] ge '5.008' ) { +if ( "$]" >= '5.008' ) { open my $strfh, "<", \$DICT or die $!; { diff --git a/dist/Storable/stacksize b/dist/Storable/stacksize index 90739d429e..2311685ae1 100644 --- a/dist/Storable/stacksize +++ b/dist/Storable/stacksize @@ -168,7 +168,7 @@ $max_depth = int(0.6 * $max_depth); $max_depth_hash = int(0.6 * $max_depth_hash); my $stack_reserve = $^O eq "MSWin32" ? 32 : 16; -if ($] ge "5.016" && !($^O eq "cygwin" && $ptrsize == 8)) { +if ("$]" >= "5.016" && !($^O eq "cygwin" && $ptrsize == 8)) { $max_depth -= $stack_reserve; $max_depth_hash -= $stack_reserve; } diff --git a/dist/Storable/t/utf8.t b/dist/Storable/t/utf8.t index 67063e7588..b8b59d83e8 100644 --- a/dist/Storable/t/utf8.t +++ b/dist/Storable/t/utf8.t @@ -21,7 +21,7 @@ is($x, ${thaw freeze \$x}, "round trip Unicode string"); # Char in the range 127-255 (probably) in utf8. This just won't work for # EBCDIC for early Perls. -$x = ($] lt 5.007_003) ? chr(175) : chr(utf8::unicode_to_native(175)) +$x = ("$]" < 5.007_003) ? chr(175) : chr(utf8::unicode_to_native(175)) . chr (256); chop $x; is($x, ${thaw freeze \$x}, "round strip a 128-255 character"); diff --git a/dist/Unicode-Normalize/mkheader b/dist/Unicode-Normalize/mkheader index 669a8a21f9..138514fca0 100644 --- a/dist/Unicode-Normalize/mkheader +++ b/dist/Unicode-Normalize/mkheader @@ -32,7 +32,7 @@ our $structname = "${prefix}complist"; # Starting in v5.20, the tables in lib/unicore are built using the platform's # native character set for code points 0-255. But in v5.35, pack U stopped # trying to compensate -*pack_U = ($] ge 5.020 && $] lt 5.035) +*pack_U = ("$]" >= 5.020 && "$]" < 5.035) ? sub { return pack('U*', map { utf8::unicode_to_native($_) } @_); } : sub { return pack('U*', @_); }; diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 7f981e8008..fab9e7a66a 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -8034,7 +8034,7 @@ ASCII matches, is to add the C</aa> modifier to the regex. This will exclude all these non-obvious matches, thus getting rid of this message. You can also say - use if $] ge 5.016, re => '/aa'; + use if "$]" >= 5.016, re => '/aa'; to apply C</aa> to all regular expressions compiled within its scope. See L<re>.
- Loading branch information