Skip to content

Commit

Permalink
Acknowledge the proper use of each builtin
Browse files Browse the repository at this point in the history
Make the Perl::Critic::Policy::Community::Each policy happy.
  • Loading branch information
Julien-Elie committed Sep 4, 2024
1 parent 9678dfb commit 6096f3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions contrib/analyze-traffic.in
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,14 @@ sub max {
my $who;
my ($field, $listref) = @_;

## no critic (Community::Each)
while (my ($peer, $statsref) = each %{$listref}) {
if ($statsref->{$field} > $x) {
$x = $statsref->{$field};
$who = $peer;
}
}
## use critic

return ($x, $who);
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/nnrp.access2readers.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if (!$debug) {
open(PASSWD, ">$passwd") or die "Could not open $passwd: $!\n";
$OUT = \*PASSWD;
}
while (my ($u, $p) = each %passwords) {
while (my ($u, $p) = each %passwords) { ## no critic (Community::Each)
$p = crypt($p, seedchar() . seedchar());
print $OUT "$u:$p\n";
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/innreport.in
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ sub ComputeTotal($) {
if (defined($cached) && !$DEBUG) { return $cached; }

my $total = 0;
while (my ($key, $value) = each %$h) {
while (my ($key, $value) = each %$h) { ## no critic (Community::Each)
confess $key unless (defined($value));
$total += $value;
}
Expand All @@ -895,13 +895,15 @@ sub ComputeTotalDouble($) {
if (defined($cached) && !$DEBUG) { return $cached; }

my $total = 0;
## no critic (Community::Each)
while (my ($key1, $value1) = each %$h) {
confess $key1 unless (defined($value1));
while (my ($key2, $value2) = each %$value1) {
confess $key2 unless (defined($value2));
$total += $value2;
}
}
## use critic
if (defined($cached) && $cached != $total) {
confess "ComputeTotalDouble mismatch $cached != $total";
}
Expand Down

0 comments on commit 6096f3c

Please sign in to comment.