fix string comparisons with $] to use numeric comparison instead
authorKaren Etheridge <ether@cpan.org>
Sun, 15 Dec 2024 20:25:18 +0000 (12:25 -0800)
committerKaren Etheridge <ether@cpan.org>
Sun, 15 Dec 2024 20:26:07 +0000 (12:26 -0800)
commit0429db7fe681a8ced0e664385b4e52777e952e0d
tree65cf8d03d8f4b12958468c04970a4e54d11b89ec
parentb1107c5a8edee87d11cada70ec25fd2119b8091f
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.
Changes
t/exotic_names.t
t/quotes-bug.t