[Rt-commit] [rtir] 11/14: Use blockless map and grep blocks
Kevin Falcone
falcone at bestpractical.com
Wed Oct 8 18:11:58 EDT 2014
This is an automated email from the git hooks/post-receive script.
falcone pushed a commit to branch 3.4/perlcritic
in repository rtir.
commit d4531d8b436bda617e492825144587e0ca771a58
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Aug 29 17:47:59 2011 -0400
Use blockless map and grep blocks
---
etc/upgrade/upgrade.pl.in | 4 ++--
lib/RT/Action/RTIR_FindIP.pm | 2 +-
lib/RT/Action/RTIR_ResolveChildren.pm | 2 +-
lib/RT/Action/RTIR_SetConstituencyGroup.pm | 2 +-
lib/RT/IR.pm | 10 +++++-----
lib/RT/IR/Test/Web.pm | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/etc/upgrade/upgrade.pl.in b/etc/upgrade/upgrade.pl.in
index e12354b..34bc01d 100644
--- a/etc/upgrade/upgrade.pl.in
+++ b/etc/upgrade/upgrade.pl.in
@@ -74,7 +74,7 @@ my $current_user = GetCurrentUser();
my $incidents = RT::Tickets->new( $current_user );
my $incidents_query =
"Queue = 'Incidents' AND Due <= '1970-01-02'"
- ." AND ( ". join( ' OR ', map "Status = '$_'", RT::Queue->ActiveStatusArray() ) ." )";
+ ." AND ( ". join( ' OR ', map { "Status = '$_'" } RT::Queue->ActiveStatusArray() ) ." )";
$incidents->FromSQL( $incidents_query );
print "\n\nGoing to update due dates of Incidents where it's not set\n";
@@ -82,7 +82,7 @@ print "\n\nGoing to update due dates of Incidents where it's not set\n";
print "Query for incidents: $incidents_query\n\n";
my $base_query = "( Queue = 'Incident Reports' OR Queue = 'Investigations' OR Queue = 'Blocks' )"
- ." AND ( ". join( ' OR ', map "Status = '$_'", RT::Queue->ActiveStatusArray() ) ." )"
+ ." AND ( ". join( ' OR ', map { "Status = '$_'" } RT::Queue->ActiveStatusArray() ) ." )"
." AND Due > '1970-01-02'";
print "Base query for children: $base_query\n\n";
diff --git a/lib/RT/Action/RTIR_FindIP.pm b/lib/RT/Action/RTIR_FindIP.pm
index e570440..11846f7 100644
--- a/lib/RT/Action/RTIR_FindIP.pm
+++ b/lib/RT/Action/RTIR_FindIP.pm
@@ -135,7 +135,7 @@ sub Commit {
);
}
elsif ( $4 && defined $5 ) { # IPv4/mask
- my $cidr = join( '.', map $_||0, (split /\./, $4)[0..3] ) ."/$5";
+ my $cidr = join( '.', map { $_||0 } (split /\./, $4)[0..3] ) ."/$5";
my $range = (Net::CIDR::cidr2range( $cidr ))[0] or next;
$spots_left -= $self->AddIP(
IP => $range, CustomField => $cf, Skip => \%existing
diff --git a/lib/RT/Action/RTIR_ResolveChildren.pm b/lib/RT/Action/RTIR_ResolveChildren.pm
index f9e1bbe..afbcc14 100644
--- a/lib/RT/Action/RTIR_ResolveChildren.pm
+++ b/lib/RT/Action/RTIR_ResolveChildren.pm
@@ -63,7 +63,7 @@ sub Prepare {
my @inactive = $self->TicketObj->QueueObj->InactiveStatusArray;
my $new_status = $self->TransactionObj->NewValue;
- return 0 unless grep $_ eq $new_status, @inactive;
+ return 0 unless grep { $_ eq $new_status } @inactive;
return 1;
}
diff --git a/lib/RT/Action/RTIR_SetConstituencyGroup.pm b/lib/RT/Action/RTIR_SetConstituencyGroup.pm
index b100573..0265db7 100644
--- a/lib/RT/Action/RTIR_SetConstituencyGroup.pm
+++ b/lib/RT/Action/RTIR_SetConstituencyGroup.pm
@@ -113,7 +113,7 @@ sub ConstituencyValues {
RT->Logger->crit("Couldn't load constituency field");
return 0;
}
- @constituencies = map $_->Name, @{ $cf->Values->ItemsArrayRef };
+ @constituencies = map { $_->Name } @{ $cf->Values->ItemsArrayRef };
}
return @constituencies;
}
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index a783f91..403adba 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -574,14 +574,14 @@ sub CustomFields {
if ( $type ) {
@list = (@{ $cache{'Global'} }, @{ $cache{$type} });
} else {
- @list = (@{ $cache{'Global'} }, map @$_, @cache{values %TYPE});
+ @list = (@{ $cache{'Global'} }, map { @$_ } @cache{values %TYPE});
}
if ( my $field = $arg{'Field'} ) {
if ( $field =~ /\D/ ) {
- @list = grep lc $_->Name eq lc $field, @list;
+ @list = grep { lc $_->Name eq lc $field } @list;
} else {
- @list = grep $_->id == $field, @list;
+ @list = grep { $_->id == $field } @list;
}
}
@@ -650,7 +650,7 @@ sub DefaultConstituency {
push @values, substr $pqueue->__Value('Name'), length("$name - ");
}
my $default = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'} || '';
- return $default if grep lc $_ eq lc $default, @values;
+ return $default if grep { lc $_ eq lc $default } @values;
return shift @values;
}
@@ -970,7 +970,7 @@ if ( RT::IR->HasConstituency ) {
if ( $tmp ) {
chomp $tmp;
$tmp = undef unless
- grep lc $_->Name eq lc $tmp, @{ $cf->Values->ItemsArrayRef };
+ grep { lc $_->Name eq lc $tmp } @{ $cf->Values->ItemsArrayRef };
}
$value = $tmp;
RT->Logger->debug("Found Constituency '$tmp' in email") if $tmp;
diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index fd24d23..954c45e 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -351,7 +351,7 @@ sub bulk_abandon {
my $self = shift;
my @to_abandon = @_;
- Test::More::diag "going to bulk abandon incidents " . join ',', map "#$_",
+ Test::More::diag "going to bulk abandon incidents " . join ',', map { "#$_" }
@to_abandon
if $ENV{'TEST_VERBOSE'};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list