Branch: refs/heads/book/fix-version-string-comparisons
Home: https://github.com/Perl/perl5
Commit: 77a58c02bbc6ce5ff8037c680a333ac3a5323d29
https://github.com/Perl/perl5/commit/77a58c02bbc6ce5ff8037c680a333ac3a5323d29
Author: Philippe Bruhat (BooK) <[email protected]>
Date: 2025-01-07 (Tue, 07 Jan 2025)
Changed paths:
M dist/Data-Dumper/Dumper.pm
M dist/Data-Dumper/t/dumper.t
Log Message:
-----------
[Data-Dumper] 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";
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications