develooper Front page | perl.perl5.changes | Postings from October 2019

[perl.git] branchsmoke-me/jkeenan/Dumpvalue-dont-call-exists-on-array-elements created.v5.31.4-320-ga333aabbd8

James Keenan via perl5-changes
October 10, 2019 22:59
[perl.git] branchsmoke-me/jkeenan/Dumpvalue-dont-call-exists-on-array-elements created.v5.31.4-320-ga333aabbd8
Message ID:
In perl.git, the branch smoke-me/jkeenan/Dumpvalue-dont-call-exists-on-array-elements has been created


        at  a333aabbd8178d79e5fb3838e7e22e4de3c7127f (commit)

- Log -----------------------------------------------------------------
commit a333aabbd8178d79e5fb3838e7e22e4de3c7127f
Author: James E Keenan <>
Date:   Thu Oct 10 18:49:20 2019 -0400

    Do not use 'exists' on arrays; use 'defined' instead
    pod/perlfunc.pod advises us:
           WARNING: Calling "exists" on array values is strongly
           discouraged. The notion of deleting or checking the existence of
           Perl array elements is not conceptually coherent, and can lead
           to surprising behavior.
    While trying to extend the test coverage of, two instances
    of 'exists ARRAYREF' were noted.  In the second of these two instances,
    using 'exists ARRAYREF' resulted in the 'if' condition of an if/else
    block always returning true, thereby making the corresponding 'else'
    condition unreachable -- a situation which was confirmed by coverage
    We should only use best practices in modules maintained by Perl 5
    Porters; this patch implements that.  When we do so, a different (but
    actually better) error message appears in the second instance; so tests
    are updated as well.


Perl5 Master Repository Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About