Name : perl-Perl-Critic-Policy-Variables-ProhibitLoopOnHash
| |
Version : 0.008
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp155.1.1
| Date : 2023-07-20 15:30:38
|
Group : Development/Libraries/Perl
| Source RPM : perl-Perl-Critic-Policy-Variables-ProhibitLoopOnHash-0.008-lp155.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Don\'t write loops on hashes, only on keys and values of hashes
|
Description :
When \"looping over hashes,\" we mean looping over hash keys or hash values. If you forgot to call \'keys\' or \'values\' you will accidentally loop over both.
foreach my $foo (%hash) {...} # not ok action() for %hash; # not ok foreach my $foo ( keys %hash ) {...} # ok action() for values %hash; # ok
An effort is made to detect expressions:
action() for %hash ? keys %hash : (); # ok action() for % ? keys % : (); # ok
(Granted, the second example there doesn\'t make much sense, but I have found a variation of it in real code.)
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-P/15.5/noarch |