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

[perl.git] branchsmoke-me/jkeenan/133492-Dumpvalue-dont-call-exists-on-array-elements updated.v5.31.4-356-g7fb18bf9c5

From:
James Keenan via perl5-changes
Date:
October 12, 2019 23:37
Subject:
[perl.git] branchsmoke-me/jkeenan/133492-Dumpvalue-dont-call-exists-on-array-elements updated.v5.31.4-356-g7fb18bf9c5
Message ID:
E1iJQx3-0003uA-9F@git.dc.perl.space
In perl.git, the branch smoke-me/jkeenan/133492-Dumpvalue-dont-call-exists-on-array-elements has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/7fb18bf9c5f8ec4216a0e66aad5068ba51a6a3de?hp=c413f9751270d07680c1ed3ebb5a1d518e8c2b15>

  discards  c413f9751270d07680c1ed3ebb5a1d518e8c2b15 (commit)
- Log -----------------------------------------------------------------
commit 7fb18bf9c5f8ec4216a0e66aad5068ba51a6a3de
Author: James E Keenan <jkeenan@cpan.org>
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 Dumpvalue.pm, 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
    analysis.
    
    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.
    
    For: RT 134492

-----------------------------------------------------------------------

Summary of changes:

-- 
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About