Skip to content

Commit 3769144

Browse files
committed
[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";
1 parent f7c41d8 commit 3769144

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpan/CPAN-Meta-Requirements/t/from-hash.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ for my $string (10, '>= 2, <= 9, != 7') {
4343

4444
SKIP: {
4545
skip "Can't tell v-strings from strings until 5.8.1", 1
46-
unless $] gt '5.008';
46+
unless "$]" > 5.008;
4747
my $string_hash = {
4848
Left => 10,
4949
Shared => '= 2',
@@ -87,7 +87,7 @@ SKIP: {
8787

8888
SKIP: {
8989
skip "Can't tell v-strings from strings until 5.8.1", 2
90-
unless $] gt '5.008';
90+
unless "$]" > 5.008;
9191
my $string_hash = {
9292
Left => 10,
9393
Shared => v50.44.60,

0 commit comments

Comments
 (0)