From cc6cf3352215ba8287ff915fae554843c9de815b Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 21 Nov 2012 23:23:31 +0000 Subject: use "any" instead of "grep" in scalar context --- urpm/parallel.pm | 2 +- urpm/select.pm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'urpm') diff --git a/urpm/parallel.pm b/urpm/parallel.pm index 6f55b841..f35843d3 100644 --- a/urpm/parallel.pm +++ b/urpm/parallel.pm @@ -178,7 +178,7 @@ sub _parse_urpmq_output { #- distant urpmq returned a choices, check if it has already been chosen #- or continue iteration to make sure no more choices are left. $$cont ||= 1; #- invalid transitory state (still choices is strange here if next sentence is not executed). - unless (grep { exists $chosen->{$_} } split /\|/, $s) { + unless (any { exists $chosen->{$_} } split /\|/, $s) { my $choice = $options{callback_choices}->($urpm, undef, $state, [ map { $urpm->search($_) } split /\|/, $s ]); if ($choice) { $chosen->{scalar $choice->fullname} = $choice; diff --git a/urpm/select.pm b/urpm/select.pm index 7bd4cc2b..416c2fd7 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -403,9 +403,9 @@ sub _resolve_priority_upgrades { my %priority_requested = map { $_->id => undef } @$priority_pkgs; $urpm->resolve_requested($db, \%priority_state, \%priority_requested, %options); - if (grep { ! exists $priority_state{selected}{$_} } keys %priority_requested) { + if (any { ! exists $priority_state{selected}{$_} } keys %priority_requested) { #- some packages which were selected previously have not been selected, strange! - } elsif (grep { ! exists $priority_state{selected}{$_} } keys %$selected) { + } elsif (any { ! exists $priority_state{selected}{$_} } keys %$selected) { #- there are other packages to install after this priority transaction. %$state = %priority_state; $need_restart = 1; @@ -572,7 +572,7 @@ sub _prohibit_packages_that_would_be_removed { }); grep { - ! grep { $base{$_} } rejected_unsatisfied($state, $_); + ! any { $base{$_} } rejected_unsatisfied($state, $_); } intersection(\@to_remove, \@base_fn); } -- cgit v1.2.1