[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-211-g369d362
Alex Vandiver
alexmv at bestpractical.com
Tue Aug 23 21:22:17 EDT 2011
The branch, 3.8/perlcritic has been updated
via 369d362977d6f8f01b5fc4dd2b309ee37241e2fb (commit)
via 5af498d56dfb756ab086895e84e13641276318af (commit)
via 2253227e46fa9a5c1dc94d1ae0559eef7e8bfe28 (commit)
via 8df98cb4f64c65535fe5e33109b4b9d80d012daf (commit)
from 5cecfffca6994a5dd8f6dc6bab81d317e60e674e (commit)
Summary of changes:
bin/fastcgi_server.in | 8 +----
bin/rt.in | 8 ++--
bin/webmux.pl.in | 18 ++---------
etc/upgrade/generate-rtaddressregexp.in | 4 +-
etc/upgrade/upgrade-mysql-schema.pl | 2 +-
lib/RT.pm.in | 8 ++--
lib/RT/ACE_Overlay.pm | 2 +-
lib/RT/ACL_Overlay.pm | 2 +-
lib/RT/Action/CreateTickets.pm | 4 +-
lib/RT/Action/Notify.pm | 6 ++--
lib/RT/Action/NotifyGroup.pm | 4 +-
lib/RT/Action/SendEmail.pm | 12 ++++----
lib/RT/Attachment_Overlay.pm | 4 +-
lib/RT/Config.pm | 25 +++++++---------
lib/RT/Crypt/GnuPG.pm | 43 +++++++++++++++-------------
lib/RT/CurrentUser.pm | 2 +-
lib/RT/CustomField_Overlay.pm | 2 +-
lib/RT/CustomFields_Overlay.pm | 2 +-
lib/RT/Date.pm | 2 +-
lib/RT/Graph/Tickets.pm | 8 ++--
lib/RT/I18N.pm | 2 +-
lib/RT/Interface/Email.pm | 45 +++++++++++++++--------------
lib/RT/Interface/Email/Auth/GnuPG.pm | 12 ++++----
lib/RT/Interface/REST.pm | 4 +-
lib/RT/Interface/Web.pm | 28 +++++++++---------
lib/RT/Interface/Web/QueryBuilder/Tree.pm | 6 ++--
lib/RT/Interface/Web/Request.pm | 6 ++--
lib/RT/Principal_Overlay.pm | 2 +-
lib/RT/Queue_Overlay.pm | 8 ++--
lib/RT/Report/Tickets.pm | 6 ++--
lib/RT/Search/Googleish.pm | 4 +-
lib/RT/Shredder.pm | 2 +-
lib/RT/Shredder/Dependencies.pm | 6 ++--
lib/RT/Shredder/Plugin/Base.pm | 2 +-
lib/RT/Shredder/Plugin/Base/Search.pm | 2 +-
lib/RT/Shredder/Plugin/Objects.pm | 2 +-
lib/RT/Shredder/Plugin/Summary.pm | 7 ++--
lib/RT/System.pm | 2 +-
lib/RT/Test.pm | 22 +++++++-------
lib/RT/Ticket_Overlay.pm | 6 ++-
lib/RT/Tickets_Overlay.pm | 13 ++++----
lib/RT/User_Overlay.pm | 2 +-
lib/RT/Users_Overlay.pm | 4 +-
sbin/extract-message-catalog | 2 +-
sbin/rt-dump-database.in | 2 +-
sbin/rt-email-group-admin.in | 4 +-
sbin/rt-setup-database.in | 12 ++++----
sbin/rt-shredder.in | 2 +-
sbin/rt-test-dependencies.in | 6 ++--
sbin/rt-validator.in | 24 ++++++++--------
50 files changed, 200 insertions(+), 211 deletions(-)
- Log -----------------------------------------------------------------
commit 8df98cb4f64c65535fe5e33109b4b9d80d012daf
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Aug 23 13:23:05 2011 -0400
Change all blockless map and grep to using blocks
diff --git a/bin/rt.in b/bin/rt.in
index 3e8429c..7549941 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -219,7 +219,7 @@ sub help {
my $titleref = $item->[2]{Title};
my @titles = ref $titleref eq 'ARRAY' ? @$titleref : $titleref;
- foreach my $title (grep $_, @titles) {
+ foreach my $title (grep {$_} @titles) {
$help{$title} = $item->[2]{Text};
}
}
@@ -590,7 +590,7 @@ sub edit {
# form if we're creating a new ticket, so that the default values
# get filled in properly.
- my @new_objects = grep /\/new$/, @objects;
+ my @new_objects = grep {/\/new$/} @objects;
if ($input) {
local $/ = undef;
@@ -1597,7 +1597,7 @@ sub expand_list {
push @elts, /^(\d+)-(\d+)$/? ($1..$2): $_;
}
- return map $_->[0], # schwartzian transform
+ return map {$_->[0]} # schwartzian transform
sort {
defined $a->[1] && defined $b->[1]?
# both numbers
@@ -1608,7 +1608,7 @@ sub expand_list {
# mix, number must be first
:defined $a->[1]? -1: 1
}
- map [ $_, ( /^(\d+)$/ ? $1 : undef), lc($_) ],
+ map {[ $_, ( /^(\d+)$/ ? $1 : undef), lc($_) ]}
@elts;
}
diff --git a/etc/upgrade/generate-rtaddressregexp.in b/etc/upgrade/generate-rtaddressregexp.in
index c48a011..fbd0b07 100644
--- a/etc/upgrade/generate-rtaddressregexp.in
+++ b/etc/upgrade/generate-rtaddressregexp.in
@@ -75,8 +75,8 @@ while ( my $queue = $queues->Next ) {
}
my %seen;
-my $re = join '|', map "\Q$_\E",
- grep defined && length && !$seen{ lc $_ }++,
+my $re = join '|', map {"\Q$_\E"}
+ grep {defined && length && !$seen{ lc $_ }++}
@addresses;
print <<ENDDESCRIPTION;
diff --git a/etc/upgrade/upgrade-mysql-schema.pl b/etc/upgrade/upgrade-mysql-schema.pl
index 5ed45f9..9e06af1 100755
--- a/etc/upgrade/upgrade-mysql-schema.pl
+++ b/etc/upgrade/upgrade-mysql-schema.pl
@@ -269,7 +269,7 @@ my $version = ($dbh->selectrow_array("show variables like 'version'"))[1];
push @sql_commands, qq{ALTER DATABASE $db_name DEFAULT CHARACTER SET utf8};
convert_table($_) foreach @tables;
-print join "\n", map(/;$/? $_ : "$_;", @sql_commands), "";
+print join "\n", map {/;$/? $_ : "$_;"} (@sql_commands, "");
my $use_p = $db_pass ? " -p" : '';
print STDERR <<ENDREMINDER;
-- ** NOTICE: No database changes have been made. **
diff --git a/lib/RT.pm.in b/lib/RT.pm.in
index a4dfa07..f87fdb2 100755
--- a/lib/RT.pm.in
+++ b/lib/RT.pm.in
@@ -474,7 +474,7 @@ sub InitClasses {
"You should delete or repair this Scrip in the admin UI.\n$@\n");
}
- foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) {
+ foreach my $class ( grep {$_} RT->Config->Get('CustomFieldValuesSources') ) {
local $@ = undef;
$class->require or $RT::Logger->error(
"Class '$class' is listed in CustomFieldValuesSources option"
@@ -604,7 +604,7 @@ sub PluginDirs {
require RT::Plugin;
my @res;
- foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
+ foreach my $plugin (grep {$_} RT->Config->Get('Plugins')) {
my $path = RT::Plugin->new( name => $plugin )->Path( $subdir );
next unless -d $path;
push @res, $path;
@@ -639,7 +639,7 @@ sub InitPluginPaths {
push @tmp_inc, @lib_dirs unless $added;
my %seen;
- @INC = grep !$seen{$_}++, @tmp_inc;
+ @INC = grep {!$seen{$_}++} @tmp_inc;
return;
}
@@ -653,7 +653,7 @@ sub InitPlugins {
my $self = shift;
my @plugins;
require RT::Plugin;
- foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
+ foreach my $plugin (grep {$_} RT->Config->Get('Plugins')) {
$plugin->require or die $UNIVERSAL::require::ERROR;
push @plugins, RT::Plugin->new(name =>$plugin);
}
diff --git a/lib/RT/ACE_Overlay.pm b/lib/RT/ACE_Overlay.pm
index 2bb2819..bbb49e2 100755
--- a/lib/RT/ACE_Overlay.pm
+++ b/lib/RT/ACE_Overlay.pm
@@ -274,7 +274,7 @@ sub Create {
#check if it's a valid RightName
if ( $args{'Object'}->can('AvailableRights') ) {
my $available = $args{'Object'}->AvailableRights;
- unless ( grep $_ eq $args{'RightName'}, map $self->CanonicalizeRightName( $_ ), keys %$available ) {
+ unless ( grep {$_ eq $args{'RightName'}} map {$self->CanonicalizeRightName( $_ )} keys %$available ) {
$RT::Logger->warning(
"Couldn't validate right name '$args{'RightName'}'"
." for object of ". ref( $args{'Object'} ) ." class"
diff --git a/lib/RT/ACL_Overlay.pm b/lib/RT/ACL_Overlay.pm
index 6dcfa76..df67845 100755
--- a/lib/RT/ACL_Overlay.pm
+++ b/lib/RT/ACL_Overlay.pm
@@ -331,7 +331,7 @@ sub _BuildHash {
my $self = shift;
while (my $entry = $self->Next) {
- my $hashkey = join '-', map $entry->__Value( $_ ),
+ my $hashkey = join '-', map {$entry->__Value( $_ )}
qw(ObjectType ObjectId RightName PrincipalId PrincipalType);
$self->{'as_hash'}->{"$hashkey"} =1;
diff --git a/lib/RT/Action/CreateTickets.pm b/lib/RT/Action/CreateTickets.pm
index 3e483f1..564cd02 100755
--- a/lib/RT/Action/CreateTickets.pm
+++ b/lib/RT/Action/CreateTickets.pm
@@ -1115,8 +1115,8 @@ sub UpdateWatchers {
my %oldhash = map { $_ => 1 } @old;
my %newhash = map { $_ => 1 } @new;
- my @add = grep( !defined $oldhash{$_}, @new );
- my @delete = grep( !defined $newhash{$_}, @old );
+ my @add = grep {!defined $oldhash{$_}} @new;
+ my @delete = grep {!defined $newhash{$_}} @old;
foreach (@add) {
my ( $val, $msg ) = $ticket->AddWatcher(
diff --git a/lib/RT/Action/Notify.pm b/lib/RT/Action/Notify.pm
index 798482c..4f1e9f3 100755
--- a/lib/RT/Action/Notify.pm
+++ b/lib/RT/Action/Notify.pm
@@ -152,9 +152,9 @@ sub SetRecipients {
@{ $self->{'Bcc'} } = @Bcc;
}
else {
- @{ $self->{'To'} } = grep ( lc $_ ne lc $creator, @To );
- @{ $self->{'Cc'} } = grep ( lc $_ ne lc $creator, @Cc );
- @{ $self->{'Bcc'} } = grep ( lc $_ ne lc $creator, @Bcc );
+ @{ $self->{'To'} } = grep {lc $_ ne lc $creator} @To;
+ @{ $self->{'Cc'} } = grep {lc $_ ne lc $creator} @Cc;
+ @{ $self->{'Bcc'} } = grep {lc $_ ne lc $creator} @Bcc;
}
# XXX 4.2: return;
return @{ $self->{'PseudoTo'} } = @PseudoTo;
diff --git a/lib/RT/Action/NotifyGroup.pm b/lib/RT/Action/NotifyGroup.pm
index 76b3950..4da8740 100644
--- a/lib/RT/Action/NotifyGroup.pm
+++ b/lib/RT/Action/NotifyGroup.pm
@@ -91,7 +91,7 @@ sub SetRecipients {
$TransactionCurrentUser->LoadByName($creatorObj->Name);
unless (RT->Config->Get('NotifyActor',$TransactionCurrentUser)) {
- @{ $self->{'To'} } = grep ( !/^\Q$creator\E$/, @{ $self->{'To'} } );
+ @{ $self->{'To'} } = grep {!/^\Q$creator\E$/} @{ $self->{'To'} };
}
$self->{'seen_ueas'} = {};
@@ -184,7 +184,7 @@ sub __HandleGroupArgument {
}
sub __SplitArg {
- return grep length, map {
+ return grep {length} map {
my $arg = $_;
$arg =~ s/^\s+//;
$arg =~ s/\s+$//;
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index aa2f499..e4325dd 100755
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -171,7 +171,7 @@ sub Prepare {
my %seen;
foreach my $type (@EMAIL_RECIPIENT_HEADERS) {
@{ $self->{$type} }
- = grep defined && length && !$seen{ lc $_ }++,
+ = grep {defined && length && !$seen{ lc $_ }++}
@{ $self->{$type} };
}
@@ -203,7 +203,7 @@ sub Prepare {
$self->SetHeader( 'Content-Transfer-Encoding', '8bit' );
# For security reasons, we only send out textual mails.
- foreach my $part ( grep !$_->is_multipart, $MIMEObj->parts_DFS ) {
+ foreach my $part ( grep {!$_->is_multipart} $MIMEObj->parts_DFS ) {
my $type = $part->mime_type || 'text/plain';
$type = 'text/plain' unless RT::I18N::IsTextualContentType($type);
$part->head->mime_attr( "Content-Type" => $type );
@@ -437,7 +437,7 @@ clean list by passing undef as argument.
sub AttachTickets {
my $self = shift;
- $list = [ grep defined, @_ ] if @_;
+ $list = [ grep {defined} @_ ] if @_;
return @$list;
}
}
@@ -748,7 +748,7 @@ clean this list when blocking is not required anymore, pass undef to do this.
sub SquelchMailTo {
my $self = shift;
if (@_) {
- $squelch = [ grep defined, @_ ];
+ $squelch = [ grep {defined} @_ ];
}
return @$squelch;
}
@@ -810,7 +810,7 @@ sub RemoveInappropriateRecipients {
}
# Let's grab the SquelchMailTo attribue and push those entries into the @blacklist
- push @blacklist, map $_->Content, $self->TicketObj->SquelchMailTo;
+ push @blacklist, map { $_->Content } $self->TicketObj->SquelchMailTo;
push @blacklist, $self->SquelchMailTo;
# Cycle through the people we're sending to and pull out anyone on the
@@ -829,7 +829,7 @@ sub RemoveInappropriateRecipients {
$RT::Logger->info( $msgid . "$addr appears to point to this RT instance. Skipping" );
next;
}
- if ( grep /^\Q$addr\E$/, @blacklist ) {
+ if ( grep {/^\Q$addr\E$/} @blacklist ) {
$RT::Logger->info( $msgid . "$addr was blacklisted for outbound mail on this transaction. Skipping");
next;
}
diff --git a/lib/RT/Attachment_Overlay.pm b/lib/RT/Attachment_Overlay.pm
index 45b6287..f7716f9 100644
--- a/lib/RT/Attachment_Overlay.pm
+++ b/lib/RT/Attachment_Overlay.pm
@@ -610,7 +610,7 @@ B<Never> returns C<RT-Send-Bcc> field.
sub SplitHeaders {
my $self = shift;
- return (grep !/^RT-Send-Bcc/i, $self->_SplitHeaders(@_) );
+ return (grep {!/^RT-Send-Bcc/i} $self->_SplitHeaders(@_) );
}
=head2 _SplitHeaders
@@ -658,7 +658,7 @@ sub Encrypt {
my $queue = $txn->TicketObj->QueueObj;
my $encrypt_for;
- foreach my $address ( grep $_,
+ foreach my $address ( grep {$_}
$queue->CorrespondAddress,
$queue->CommentAddress,
RT->Config->Get('CorrespondAddress'),
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ff167e7..2be36b7 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -633,7 +633,7 @@ EOF
sub PostLoadCheck {
my $self = shift;
- foreach my $o ( grep $META{$_}{'PostLoadCheck'}, $self->Options( Overridable => undef ) ) {
+ foreach my $o ( grep {$META{$_}{'PostLoadCheck'}} $self->Options( Overridable => undef ) ) {
$META{$o}->{'PostLoadCheck'}->( $self, $self->Get($o) );
}
return;
@@ -653,14 +653,14 @@ sub Configs {
foreach my $path ( $RT::LocalEtcPath, RT->PluginDirs('etc'), $RT::EtcPath ) {
my $mask = File::Spec->catfile( $path, "*_Config.pm" );
my @files = glob $mask;
- @files = grep !/^RT_Config\.pm$/,
- grep $_ && /^\w+_Config\.pm$/,
+ @files = grep {!/^RT_Config\.pm$/}
+ grep {$_ && /^\w+_Config\.pm$/}
map { m/^.*[\\\/](.*)/ ? $1 : $_ } @files;
push @configs, sort @files;
}
my %seen;
- @configs = grep !$seen{$_}++, @configs;
+ @configs = grep {!$seen{$_}++} @configs;
return @configs;
}
@@ -899,8 +899,8 @@ sub Sections {
my $self = shift;
my %seen;
my @sections = sort
- grep !$seen{$_}++,
- map $_->{'Section'} || 'General',
+ grep {!$seen{$_}++}
+ map {$_->{'Section'} || 'General'}
values %META;
return @sections;
}
@@ -909,21 +909,18 @@ sub Options {
my $self = shift;
my %args = ( Section => undef, Overridable => 1, Sorted => 1, @_ );
my @res = keys %META;
-
- @res = grep( ( $META{$_}->{'Section'} || 'General' ) eq $args{'Section'},
- @res
- ) if defined $args{'Section'};
+
+ @res = grep { ( $META{$_}->{'Section'} || 'General' ) eq $args{'Section'} } @res
+ if defined $args{'Section'};
if ( defined $args{'Overridable'} ) {
- @res
- = grep( ( $META{$_}->{'Overridable'} || 0 ) == $args{'Overridable'},
- @res );
+ @res = grep { ( $META{$_}->{'Overridable'} || 0 ) == $args{'Overridable'} } @res;
}
if ( $args{'Sorted'} ) {
@res = sort {
($META{$a}->{SortOrder}||9999) <=> ($META{$b}->{SortOrder}||9999)
- || $a cmp $b
+ || $a cmp $b
} @res;
} else {
@res = sort { $a cmp $b } @res;
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 568f5b9..14cc224 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -527,8 +527,9 @@ sub SignEncrypt {
if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
my %seen;
$args{'Recipients'} = [
- grep $_ && !$seen{ $_ }++, map $_->address,
- map Email::Address->parse( $entity->head->get( $_ ) ),
+ grep {$_ && !$seen{ $_ }++}
+ map { $_->address }
+ map { Email::Address->parse( $entity->head->get( $_ ) ) }
qw(To Cc Bcc)
];
}
@@ -559,7 +560,7 @@ sub SignEncryptRFC3156 {
my %res;
if ( $args{'Sign'} && !$args{'Encrypt'} ) {
# required by RFC3156(Ch. 5) and RFC1847(Ch. 2.1)
- foreach ( grep !$_->is_multipart, $entity->parts_DFS ) {
+ foreach ( grep {!$_->is_multipart} $entity->parts_DFS ) {
my $tenc = $_->head->mime_encoding;
unless ( $tenc =~ m/^(?:7bit|quoted-printable|base64)$/i ) {
$_->head->mime_attr( 'Content-Transfer-Encoding'
@@ -595,8 +596,8 @@ sub SignEncryptRFC3156 {
);
}
if ( $args{'Encrypt'} ) {
- my @recipients = map $_->address,
- map Email::Address->parse( $entity->head->get( $_ ) ),
+ my @recipients = map { $_->address }
+ map { Email::Address->parse( $entity->head->get( $_ ) ) }
qw(To Cc Bcc);
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
@@ -891,8 +892,8 @@ sub FindProtectedParts {
my ($file_name) = $sig_name =~ /^(.*?)(?:\.sig)?$/;
my ($data_part_idx) =
- grep $file_name eq ($entity->parts($_)->head->recommended_filename||''),
- grep $sig_part ne $entity->parts($_),
+ grep {$file_name eq ($entity->parts($_)->head->recommended_filename||'')}
+ grep {$sig_part ne $entity->parts($_)}
0 .. $entity->parts - 1;
unless ( defined $data_part_idx ) {
$RT::Logger->error("Found $sig_name attachment, but didn't find $file_name");
@@ -929,7 +930,7 @@ sub FindProtectedParts {
}
push @res, FindProtectedParts( Entity => $_ )
- foreach grep !$skip{"$_"}, $entity->parts;
+ foreach grep {!$skip{"$_"}} $entity->parts;
return @res;
}
@@ -949,7 +950,7 @@ sub VerifyDecrypt {
my @protected = FindProtectedParts( Entity => $args{'Entity'} );
my @res;
# XXX: detaching may brake nested signatures
- foreach my $item( grep $_->{'Type'} eq 'signed', @protected ) {
+ foreach my $item( grep {$_->{'Type'} eq 'signed'} @protected ) {
my $status_on;
if ( $item->{'Format'} eq 'RFC3156' ) {
push @res, { VerifyRFC3156( %$item, SetStatus => $args{'SetStatus'} ) };
@@ -965,7 +966,7 @@ sub VerifyDecrypt {
push @res, { VerifyAttachment( %$item ) };
if ( $args{'Detach'} ) {
$item->{'Top'}->parts( [
- grep "$_" ne $item->{'Signature'}, $item->{'Top'}->parts
+ grep {"$_" ne $item->{'Signature'}} $item->{'Top'}->parts
] );
$item->{'Top'}->make_singlepart;
}
@@ -978,7 +979,7 @@ sub VerifyDecrypt {
);
}
}
- foreach my $item( grep $_->{'Type'} eq 'encrypted', @protected ) {
+ foreach my $item( grep {$_->{'Type'} eq 'encrypted'} @protected ) {
my $status_on;
if ( $item->{'Format'} eq 'RFC3156' ) {
push @res, { DecryptRFC3156( %$item ) };
@@ -1617,15 +1618,15 @@ sub _ParseUserHint {
return (
MainKey => $main_key_id,
String => $user_str,
- EmailAddress => (map $_->address, Email::Address->parse( $user_str ))[0],
+ EmailAddress => (map { $_->address } Email::Address->parse( $user_str ))[0],
);
}
sub _PrepareGnuPGOptions {
my %opt = @_;
- my %res = map { lc $_ => $opt{ $_ } } grep $supported_opt{ lc $_ }, keys %opt;
+ my %res = map { lc $_ => $opt{ $_ } } grep {$supported_opt{ lc $_ }} keys %opt;
$res{'extra_args'} ||= [];
- foreach my $o ( grep !$supported_opt{ lc $_ }, keys %opt ) {
+ foreach my $o ( grep {!$supported_opt{ lc $_ }} keys %opt ) {
push @{ $res{'extra_args'} }, '--'. lc $o;
push @{ $res{'extra_args'} }, $opt{ $o }
if defined $opt{ $o };
@@ -1642,7 +1643,7 @@ sub UseKeyForEncryption {
%key = ();
} elsif ( @_ > 1 ) {
%key = (%key, @_);
- $key{ lc($_) } = delete $key{ $_ } foreach grep lc ne $_, keys %key;
+ $key{ lc($_) } = delete $key{ $_ } for grep {lc ne $_} keys %key;
} else {
return $key{ $_[0] };
}
@@ -1708,7 +1709,7 @@ sub CheckRecipients {
my ($status, @issues) = (1, ());
my %seen;
- foreach my $address ( grep !$seen{ lc $_ }++, map $_->address, @recipients ) {
+ foreach my $address ( grep {!$seen{ lc $_ }++} map {$_->address} @recipients ) {
my %res = GetKeysForEncryption( $address );
if ( $res{'info'} && @{ $res{'info'} } == 1 && $res{'info'}[0]{'TrustLevel'} > 0 ) {
# good, one suitable and trusted key
@@ -1722,8 +1723,8 @@ sub CheckRecipients {
if ( my $fpr = UseKeyForEncryption( $address ) ) {
if ( $res{'info'} && @{ $res{'info'} } ) {
next if
- grep lc $_->{'Fingerprint'} eq lc $fpr,
- grep $_->{'TrustLevel'} > 0,
+ grep {lc $_->{'Fingerprint'} eq lc $fpr}
+ grep {$_->{'TrustLevel'} > 0}
@{ $res{'info'} };
}
@@ -2078,7 +2079,7 @@ sub Probe {
sub _make_gpg_handles {
my %handle_map = (@_);
$handle_map{$_} = IO::Handle->new
- foreach grep !defined $handle_map{$_},
+ foreach grep {!defined $handle_map{$_}}
qw(stdin stdout stderr logger status command);
my $handles = GnuPG::Handles->new(%handle_map);
diff --git a/lib/RT/CurrentUser.pm b/lib/RT/CurrentUser.pm
index 84a316b..2364d26 100755
--- a/lib/RT/CurrentUser.pm
+++ b/lib/RT/CurrentUser.pm
@@ -242,7 +242,7 @@ sub loc {
if (@_ == 1) {
# pre-scan the lexicon hashes to return _AUTO keys verbatim,
# to keep locstrings containing '[' and '~' from tripping over Maketext
- return $_[0] unless grep exists $_->{$_[0]}, @{ $handle->_lex_refs };
+ return $_[0] unless grep {exists $_->{$_[0]}} @{ $handle->_lex_refs };
}
return $handle->maketext(@_);
diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index 3675f04..ef0d4fc 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -832,7 +832,7 @@ Returns an array of all possible composite values for custom fields.
sub TypeComposites {
my $self = shift;
- return grep !/(?:[Tt]ext|Combobox)-0/, map { ("$_-1", "$_-0") } $self->Types;
+ return grep {!/(?:[Tt]ext|Combobox)-0/} map { ("$_-1", "$_-0") } $self->Types;
}
=head2 SetLookupType
diff --git a/lib/RT/CustomFields_Overlay.pm b/lib/RT/CustomFields_Overlay.pm
index a671518..1fad079 100755
--- a/lib/RT/CustomFields_Overlay.pm
+++ b/lib/RT/CustomFields_Overlay.pm
@@ -179,7 +179,7 @@ sub LimitToNotApplied {
FIELD => 'ObjectId',
OPERATOR => 'IN',
QUOTEVALUE => 0,
- VALUE => "(". join( ',', map $dbh->quote($_), @ids ) .")",
+ VALUE => "(". join( ',', map { $dbh->quote($_) } @ids ) .")",
);
}
diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index d300f7e..eae3ead 100755
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -824,7 +824,7 @@ sub RFC2822 {
$time .= sprintf " %s%02d%02d", $self->_SplitOffset( $offset );
}
- return join ' ', grep $_, ($date, $time);
+ return join ' ', grep {$_} ($date, $time);
}
=head3 RFC2616 (HTTP)
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index e5993be..80a842f 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -113,7 +113,7 @@ our %property_cb = (
Queue => sub { return $_[0]->QueueObj->Name || $_[0]->Queue },
CF => sub {
my $values = $_[0]->CustomFieldValues( $_[1] );
- return join ', ', map $_->Content, @{ $values->ItemsArrayRef };
+ return join ', ', map { $_->Content } @{ $values->ItemsArrayRef };
},
);
foreach my $field (qw(Subject Status TimeLeft TimeWorked TimeEstimated)) {
@@ -139,12 +139,12 @@ foreach my $field (qw(Told Starts Started Due Resolved LastUpdated Created)) {
}
foreach my $field (qw(Members DependedOnBy ReferredToBy)) {
$property_cb{ $field } = sub {
- return join ', ', map $_->BaseObj->id, @{ $_[0]->$field->ItemsArrayRef };
+ return join ', ', map { $_->BaseObj->id } @{ $_[0]->$field->ItemsArrayRef };
};
}
foreach my $field (qw(MemberOf DependsOn RefersTo)) {
$property_cb{ $field } = sub {
- return join ', ', map $_->TargetObj->id, @{ $_[0]->$field->ItemsArrayRef };
+ return join ', ', map { $_->TargetObj->id } @{ $_[0]->$field->ItemsArrayRef };
};
}
@@ -178,7 +178,7 @@ sub _SplitProperty {
my $self = shift;
my $property = shift;
my ($key, @subkeys) = split /\./, $property;
- foreach ( grep /^{.*}$/, @subkeys ) {
+ foreach ( grep {/^{.*}$/} @subkeys ) {
s/^{//;
s/}$//;
}
diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index 35e02e0..dc2f82f 100755
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -107,7 +107,7 @@ sub Init {
$file = $1;
my ($lang) = ($file =~ /([^\\\/]+?)\.pm$/);
- next unless grep $_ eq '*' || $_ eq $lang, @lang;
+ next unless grep {$_ eq '*' || $_ eq $lang} @lang;
require $file;
}
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 8b96581..6458a05 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -485,8 +485,9 @@ sub SendEmail {
# duplicate head as we want drop Bcc field
my $head = $args{'Entity'}->head->dup;
- my @recipients = map $_->address, map
- Email::Address->parse($head->get($_)), qw(To Cc Bcc);
+ my @recipients = map { $_->address }
+ map { Email::Address->parse($head->get($_)) }
+ qw(To Cc Bcc);
$head->delete('Bcc');
my $sender = RT->Config->Get('SMTPFrom')
@@ -595,7 +596,7 @@ sub SendEmailUsingTemplate {
}
$mail->head->set( $_ => Encode::encode_utf8( $args{ $_ } ) )
- foreach grep defined $args{$_}, qw(To Cc Bcc From);
+ foreach grep {defined $args{$_}} qw(To Cc Bcc From);
SetInReplyTo( Message => $mail, InReplyTo => $args{'InReplyTo'} );
@@ -636,8 +637,8 @@ sub ForwardTicket {
my $entity = MIME::Entity->build(
Type => 'multipart/mixed',
);
- $entity->add_part( $_ ) foreach
- map $_->ContentAsMIME,
+ $entity->add_part( $_ ) foreach
+ map { $_->ContentAsMIME }
@{ $txns->ItemsArrayRef };
return SendForward( %args, Entity => $entity, Ticket => $ticket, Template => 'Forward Ticket' );
@@ -701,7 +702,7 @@ sub SendForward {
}
$mail->head->set( $_ => EncodeToMIME( String => $args{$_} ) )
- foreach grep defined $args{$_}, qw(To Cc Bcc);
+ foreach grep {defined $args{$_}} qw(To Cc Bcc);
$mail->attach(
Type => 'message/rfc822',
@@ -820,7 +821,7 @@ sub SignEncrypt {
DeleteRecipientsFromHead(
$args{'Entity'}->head,
- map $_->{'AddressObj'}->address, @bad_recipients
+ map { $_->{'AddressObj'}->address } @bad_recipients
);
unless ( $args{'Entity'}->head->get('To')
@@ -911,7 +912,7 @@ sub EncodeToMIME {
# encode an join chuncks
$value = join "\n ",
- map MIME::Words::encode_mimeword( $_, $encoding, $charset ),
+ map { MIME::Words::encode_mimeword( $_, $encoding, $charset ) }
@chunks;
return ($value);
}
@@ -996,9 +997,9 @@ sub ParseCcAddressesFromHead {
my $user = $args{'CurrentUser'}->UserObj;
return
- grep $_ ne $current_address && !RT::EmailParser->IsRTAddress( $_ ),
- map lc $user->CanonicalizeEmailAddress( $_->address ),
- map Email::Address->parse( $args{'Head'}->get( $_ ) ),
+ grep { $_ ne $current_address && !RT::EmailParser->IsRTAddress( $_ ) }
+ map { lc $user->CanonicalizeEmailAddress( $_->address ) }
+ map { Email::Address->parse( $args{'Head'}->get( $_ ) ) }
qw(To Cc);
}
@@ -1067,7 +1068,7 @@ sub ParseAddressFromHeader {
$Addr =~ s/\"\"(.*?)\"\"/\"$1\"/g;
my @Addresses = RT::EmailParser->ParseEmailAddress($Addr);
- my ($AddrObj) = grep ref $_, @Addresses;
+ my ($AddrObj) = grep {ref $_} @Addresses;
unless ( $AddrObj ) {
return ( undef, undef );
}
@@ -1093,7 +1094,7 @@ sub DeleteRecipientsFromHead {
foreach my $field ( qw(To Cc Bcc) ) {
$head->set( $field =>
- join ', ', map $_->format, grep !$skip{ lc $_->address },
+ join ', ', map {$_->format} grep {!$skip{ lc $_->address }}
Email::Address->parse( $head->get( $field ) )
);
}
@@ -1132,7 +1133,7 @@ sub SetInReplyTo {
} else {
@res = $args{'InReplyTo'}->GetHeader( shift ) || '';
}
- return grep length, map { split /\s+/m, $_ } grep defined, @res;
+ return grep {length} map { split /\s+/m, $_ } grep {defined} @res;
};
my @id = $get_header->('Message-ID');
@@ -1145,7 +1146,7 @@ sub SetInReplyTo {
push @references, @id, @rtid;
if ( $args{'Ticket'} ) {
my $pseudo_ref = '<RT-Ticket-'. $args{'Ticket'}->id .'@'. RT->Config->Get('Organization') .'>';
- push @references, $pseudo_ref unless grep $_ eq $pseudo_ref, @references;
+ push @references, $pseudo_ref unless grep {$_ eq $pseudo_ref} @references;
}
@references = splice @references, 4, -6
if @references > 10;
@@ -1312,12 +1313,12 @@ sub Gateway {
);
}
- my @mail_plugins = grep $_, RT->Config->Get('MailPlugins');
+ my @mail_plugins = grep {$_} RT->Config->Get('MailPlugins');
push @mail_plugins, "Auth::MailFrom" unless @mail_plugins;
@mail_plugins = _LoadPlugins( @mail_plugins );
my %skip_plugin;
- foreach my $class( grep !ref, @mail_plugins ) {
+ foreach my $class( grep {!ref} @mail_plugins ) {
# check if we should apply filter before decoding
my $check_cb = $class->can("ApplyBeforeDecode");
next unless defined $check_cb;
@@ -1341,7 +1342,7 @@ sub Gateway {
return (0, $msg, undef);
}
}
- @mail_plugins = grep !$skip_plugin{"$_"}, @mail_plugins;
+ @mail_plugins = grep {!$skip_plugin{"$_"}} @mail_plugins;
$parser->_DecodeBodies;
$parser->_PostProcessNewEntity;
@@ -1444,7 +1445,7 @@ sub Gateway {
my $Ticket = RT::Ticket->new($CurrentUser);
- if ( !$args{'ticket'} && grep /^(comment|correspond)$/, @actions )
+ if ( !$args{'ticket'} && grep {/^(comment|correspond)$/} @actions )
{
my @Cc;
@@ -1477,7 +1478,7 @@ sub Gateway {
# strip comments&corresponds from the actions we don't need
# to record them if we've created the ticket just now
- @actions = grep !/^(comment|correspond)$/, @actions;
+ @actions = grep {!/^(comment|correspond)$/} @actions;
$args{'ticket'} = $id;
} elsif ( $args{'ticket'} ) {
@@ -1593,7 +1594,7 @@ sub GetAuthenticationLevel {
}
# strip actions we should skip
- @{$args{Actions}} = grep !$skip_action{$_}, @{$args{Actions}}
+ @{$args{Actions}} = grep {!$skip_action{$_}} @{$args{Actions}}
if $AuthStat == -2;
last unless @{$args{Actions}};
@@ -1781,7 +1782,7 @@ Returns a list of valid actions we've found for this message
sub IsCorrectAction {
my $action = shift;
- my @actions = grep $_, split /-/, $action;
+ my @actions = grep {$_} split /-/, $action;
return ( 0, '(no value)' ) unless @actions;
foreach ( @actions ) {
return ( 0, $_ ) unless /^(?:comment|correspond|take|resolve)$/;
diff --git a/lib/RT/Interface/Email/Auth/GnuPG.pm b/lib/RT/Interface/Email/Auth/GnuPG.pm
index 5f6ccd5..99f0822 100644
--- a/lib/RT/Interface/Email/Auth/GnuPG.pm
+++ b/lib/RT/Interface/Email/Auth/GnuPG.pm
@@ -171,12 +171,12 @@ sub CheckNoPrivateKey {
my %args = (Message => undef, Status => [], @_ );
my @status = @{ $args{'Status'} };
- my @decrypts = grep $_->{'Operation'} eq 'Decrypt', @status;
+ my @decrypts = grep {$_->{'Operation'} eq 'Decrypt'} @status;
return 1 unless @decrypts;
foreach my $action ( @decrypts ) {
# if at least one secrete key exist then it's another error
return 1 if
- grep !$_->{'User'}{'SecretKeyMissing'},
+ grep {!$_->{'User'}{'SecretKeyMissing'}}
@{ $action->{'EncryptedTo'} };
}
@@ -200,9 +200,9 @@ sub CheckNoPrivateKey {
sub CheckBadData {
my %args = (Message => undef, Status => [], @_ );
- my @bad_data_messages =
- map $_->{'Message'},
- grep $_->{'Status'} ne 'DONE' && $_->{'Operation'} eq 'Data',
+ my @bad_data_messages =
+ map {$_->{'Message'}}
+ grep {$_->{'Status'} ne 'DONE' && $_->{'Operation'} eq 'Data'}
@{ $args{'Status'} };
return 1 unless @bad_data_messages;
@@ -239,7 +239,7 @@ sub VerifyDecrypt {
$RT::Logger->debug('Found GnuPG protected parts');
# return on any error
- if ( grep $_->{'exit_code'}, @res ) {
+ if ( grep {$_->{'exit_code'}} @res ) {
$RT::Logger->debug("Error during verify/decrypt operation");
return (0, @res);
}
diff --git a/lib/RT/Interface/REST.pm b/lib/RT/Interface/REST.pm
index 18d4b1b..e9fbf3a 100755
--- a/lib/RT/Interface/REST.pm
+++ b/lib/RT/Interface/REST.pm
@@ -100,7 +100,7 @@ sub expand_list {
push @elts, /^(\d+)-(\d+)$/? ($1..$2): $_;
}
- return map $_->[0], # schwartzian transform
+ return map { $_->[0] } # schwartzian transform
sort {
defined $a->[1] && defined $b->[1]?
# both numbers
@@ -111,7 +111,7 @@ sub expand_list {
# mix, number must be first
:defined $a->[1]? -1: 1
}
- map [ $_, ( /^(\d+)$/ ? $1 : undef), lc($_) ],
+ map { [ $_, ( /^(\d+)$/ ? $1 : undef), lc($_) ] }
@elts;
}
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index ea6b44d..56c980a 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1183,8 +1183,8 @@ sub CreateTicket {
my @temp_squelch;
foreach my $type (qw(Requestor Cc AdminCc)) {
- push @temp_squelch, map $_->address, Email::Address->parse( $create_args{$type} )
- if grep $_ eq $type || $_ eq ( $type . 's' ), @{ $ARGS{'SkipNotification'} || [] };
+ push @temp_squelch, map { $_->address } Email::Address->parse( $create_args{$type} )
+ if grep {$_ eq $type || $_ eq ( $type . 's' )} @{ $ARGS{'SkipNotification'} || [] };
}
@@ -1234,14 +1234,14 @@ sub CreateTicket {
} elsif ( defined $ARGS{$arg} ) {
@values = split /\r*\n/, $ARGS{$arg};
}
- @values = grep length, map {
+ @values = grep {length} map {
my $value = $_;
$value =~ s/\r+\n/\n/g;
$value =~ s/^\s+//;
$value =~ s/\s+$//;
$value;
}
- grep defined, @values;
+ grep {defined} @values;
$create_args{"CustomField-$cfid"} = \@values;
}
@@ -1258,7 +1258,7 @@ sub CreateTicket {
);
foreach my $key ( keys %map ) {
next unless $ARGS{$key};
- $create_args{ $map{$key} } = [ grep $_, split ' ', $ARGS{$key} ];
+ $create_args{ $map{$key} } = [ grep {$_} split ' ', $ARGS{$key} ];
}
@@ -1411,14 +1411,14 @@ sub ProcessUpdateMessage {
my @temp_squelch;
foreach my $type (qw(Cc AdminCc)) {
- if (grep $_ eq $type || $_ eq ( $type . 's' ), @{ $args{ARGSRef}->{'SkipNotification'} || [] }) {
- push @temp_squelch, map $_->address, Email::Address->parse( $message_args{$type} );
+ if (grep {$_ eq $type || $_ eq ( $type . 's' )} @{ $args{ARGSRef}->{'SkipNotification'} || [] }) {
+ push @temp_squelch, map { $_->address } Email::Address->parse( $message_args{$type} );
push @temp_squelch, $args{TicketObj}->$type->MemberEmailAddresses;
push @temp_squelch, $args{TicketObj}->QueueObj->$type->MemberEmailAddresses;
}
}
- if (grep $_ eq 'Requestor' || $_ eq 'Requestors', @{ $args{ARGSRef}->{'SkipNotification'} || [] }) {
- push @temp_squelch, map $_->address, Email::Address->parse( $message_args{Requestor} );
+ if (grep {$_ eq 'Requestor' || $_ eq 'Requestors'} @{ $args{ARGSRef}->{'SkipNotification'} || [] }) {
+ push @temp_squelch, map { $_->address } Email::Address->parse( $message_args{Requestor} );
push @temp_squelch, $args{TicketObj}->Requestors->MemberEmailAddresses;
}
@@ -1486,7 +1486,7 @@ sub MakeMIMEEntity {
my $Message = MIME::Entity->build(
Type => 'multipart/mixed',
map { $_ => Encode::encode_utf8( $args{ $_} ) }
- grep defined $args{$_}, qw(Subject From Cc)
+ grep {defined $args{$_}} qw(Subject From Cc)
);
if ( defined $args{'Body'} && length $args{'Body'} ) {
@@ -1583,7 +1583,7 @@ sub ProcessACLChanges {
} else {
@rights = $ARGSref->{$arg};
}
- @rights = grep $_, @rights;
+ @rights = grep {$_} @rights;
next unless @rights;
my $principal = RT::Principal->new( $session{'CurrentUser'} );
@@ -1883,14 +1883,14 @@ sub _ProcessObjectCustomFieldUpdates {
@values = split /\r*\n/, $args{'ARGS'}->{$arg}
if defined $args{'ARGS'}->{$arg};
}
- @values = grep length, map {
+ @values = grep {length} map {
my $value = $_;
$value =~ s/\r+\n/\n/g;
$value =~ s/^\s+//;
$value =~ s/\s+$//;
$value;
}
- grep defined, @values;
+ grep {defined} @values;
if ( $arg eq 'AddValue' || $arg eq 'Value' ) {
foreach my $value (@values) {
@@ -2280,7 +2280,7 @@ sub ProcessColumnMapValue {
my @tmp = $value->( @{ $args{'Arguments'} } );
return ProcessColumnMapValue( ( @tmp > 1 ? \@tmp : $tmp[0] ), %args );
} elsif ( ref($value) eq 'ARRAY' ) {
- return join '', map ProcessColumnMapValue( $_, %args ), @$value;
+ return join '', map { ProcessColumnMapValue( $_, %args ) } @$value;
} elsif ( ref($value) eq 'SCALAR' ) {
return $$value;
}
diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index e94f70c..e1ffaab 100755
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -142,10 +142,10 @@ sub GetQueryAndOptionList {
my $list = $self->__LinearizeTree;
foreach my $e( @$list ) {
$e->{'DEPTH'} = $e->{'NODE'}->getDepth;
- $e->{'SELECTED'} = (grep $_ == $e->{'NODE'}, @$selected_nodes)? qq[ selected="selected"] : '';
+ $e->{'SELECTED'} = (grep {$_ == $e->{'NODE'}} @$selected_nodes)? qq[ selected="selected"] : '';
}
- return (join ' ', map $_->{'TEXT'}, @$list), $list;
+ return (join ' ', map { $_->{'TEXT'} } @$list), $list;
}
=head2 PruneChildLessAggregators
@@ -186,7 +186,7 @@ In fact, it's all of them but the root and its child.
=cut
sub GetDisplayedNodes {
- return map $_->{NODE}, @{ (shift)->__LinearizeTree };
+ return map { $_->{NODE} } @{ (shift)->__LinearizeTree };
}
diff --git a/lib/RT/Interface/Web/Request.pm b/lib/RT/Interface/Web/Request.pm
index f682f71..0d418af 100644
--- a/lib/RT/Interface/Web/Request.pm
+++ b/lib/RT/Interface/Web/Request.pm
@@ -122,17 +122,17 @@ sub callback {
unless ( $callbacks ) {
$callbacks = [];
my $path = "/Callbacks/*$page/$name";
- my @roots = map $_->[1],
+ my @roots = map { $_->[1] }
$HTML::Mason::VERSION <= 1.28
? $self->interp->resolver->comp_root_array
: $self->interp->comp_root_array;
my %seen;
@$callbacks = (
- grep defined && length,
+ grep {defined && length}
# Skip backup files, files without a leading package name,
# and files we've already seen
- grep !$seen{$_}++ && !m{/\.} && !m{~$} && m{^/Callbacks/[^/]+\Q$page/$name\E$},
+ grep {!$seen{$_}++ && !m{/\.} && !m{~$} && m{^/Callbacks/[^/]+\Q$page/$name\E$}}
map { sort $self->interp->resolver->glob_path($path, $_) }
@roots
);
diff --git a/lib/RT/Principal_Overlay.pm b/lib/RT/Principal_Overlay.pm
index aa9f23e..7d9ef06 100755
--- a/lib/RT/Principal_Overlay.pm
+++ b/lib/RT/Principal_Overlay.pm
@@ -472,7 +472,7 @@ sub _HasRoleRight
. "AND Principals.id = CachedGroupMembers.GroupId "
. "AND CachedGroupMembers.MemberId = ". $self->Id ." "
- . "AND (". join(' OR ', map "Groups.Type = '$_'", @roles ) .")"
+ . "AND (". join(' OR ', map { "Groups.Type = '$_'" } @roles ) .")"
;
my (@object_clauses);
diff --git a/lib/RT/Queue_Overlay.pm b/lib/RT/Queue_Overlay.pm
index d467b7b..e0c1a78 100755
--- a/lib/RT/Queue_Overlay.pm
+++ b/lib/RT/Queue_Overlay.pm
@@ -255,7 +255,7 @@ sub IsValidStatus {
my $self = shift;
my $value = shift;
- my $retval = grep ( $_ eq $value, $self->StatusArray );
+ my $retval = grep {$_ eq $value} $self->StatusArray;
return ($retval);
}
@@ -275,7 +275,7 @@ sub IsActiveStatus {
my $self = shift;
my $value = shift;
- my $retval = grep ( $_ eq $value, $self->ActiveStatusArray );
+ my $retval = grep {$_ eq $value} $self->ActiveStatusArray;
return ($retval);
}
@@ -295,7 +295,7 @@ sub IsInactiveStatus {
my $self = shift;
my $value = shift;
- my $retval = grep ( $_ eq $value, $self->InactiveStatusArray );
+ my $retval = grep {$_ eq $value} $self->InactiveStatusArray;
return ($retval);
}
@@ -355,7 +355,7 @@ sub Create {
#TODO better input validation
$RT::Handle->BeginTransaction();
- my $id = $self->SUPER::Create( map { $_ => $args{$_} } grep exists $args{$_}, keys %attrs );
+ my $id = $self->SUPER::Create( map { $_ => $args{$_} } grep {exists $args{$_}} keys %attrs );
unless ($id) {
$RT::Handle->Rollback();
return ( 0, $self->loc('Queue could not be created') );
diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 2cb2fbf..c66aeaf 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -131,7 +131,7 @@ sub SetupGroupings {
my @res;
push @res, $self->Column( FUNCTION => ($joined? 'DISTINCT COUNT' : 'COUNT'), FIELD => 'id' );
- push @res, map $self->Column( FIELD => $_ ), @group_by;
+ push @res, map { $self->Column( FIELD => $_ ) } @group_by;
return @res;
}
@@ -139,7 +139,7 @@ sub GroupBy {
my $self = shift;
my @args = ref $_[0]? @_ : { @_ };
- @{ $self->{'_group_by_field'} ||= [] } = map $_->{'FIELD'}, @args;
+ @{ $self->{'_group_by_field'} ||= [] } = map { $_->{'FIELD'} } @args;
$_ = { $self->_FieldToFunction( %$_ ) } foreach @args;
return $self->SUPER::GroupBy( @args );
@@ -312,7 +312,7 @@ sub AddEmptyRows {
if ( @{ $self->{'_group_by_field'} || [] } == 1 && $self->{'_group_by_field'}[0] eq 'Status' ) {
my %has = map { $_->__Value('Status') => 1 } @{ $self->ItemsArrayRef || [] };
- foreach my $status ( grep !$has{$_}, RT::Queue->new($self->CurrentUser)->StatusArray ) {
+ foreach my $status ( grep {!$has{$_}} RT::Queue->new($self->CurrentUser)->StatusArray ) {
my $record = $self->NewItem;
$record->LoadFromHash( {
diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index 6e06d39..c98cfcb 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -95,7 +95,7 @@ sub QueryToSQL {
my $self = shift;
my $query = shift || $self->Argument;
- my @keywords = grep length, map { my $word = $_; $word =~ s/^\s+//; $word =~ s/\s+$//; $word }
+ my @keywords = grep {length} map { my $word = $_; $word =~ s/^\s+//; $word =~ s/\s+$//; $word }
split /((?:fulltext:)?$re_delim|\s+)/o, $query;
my (
@@ -179,7 +179,7 @@ sub QueryToSQL {
push @tql_clauses, join( " OR ", sort @id_clauses );
push @tql_clauses, join( " OR ", sort @owner_clauses );
if ( ! @status_clauses ) {
- push @tql_clauses, join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray());
+ push @tql_clauses, join( " OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray());
} else {
push @tql_clauses, join( " OR ", sort @status_clauses );
}
diff --git a/lib/RT/Shredder.pm b/lib/RT/Shredder.pm
index 285b80b..0a0873f 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -765,7 +765,7 @@ sub DumpObject {
return unless $active_dump_state{ lc $args{'State'} };
foreach (@{ $self->{'dump_plugins'} }) {
- next unless grep lc $args{'State'} eq lc $_, $_->AppliesToStates;
+ next unless grep {lc $args{'State'} eq lc $_} $_->AppliesToStates;
my ($state, $msg) = $_->Run( %args );
die "Couldn't run plugin: $msg" unless $state;
}
diff --git a/lib/RT/Shredder/Dependencies.pm b/lib/RT/Shredder/Dependencies.pm
index 3391501..d12830f 100644
--- a/lib/RT/Shredder/Dependencies.pm
+++ b/lib/RT/Shredder/Dependencies.pm
@@ -141,9 +141,9 @@ sub List
my $woflags = delete $args{'WithoutFlags'};
return
- map $args{'Callback'}? $args{'Callback'}->($_): $_,
- grep !defined( $wflags ) || ($_->Flags & $wflags) == $wflags,
- grep !defined( $woflags ) || !($_->Flags & $woflags),
+ map {$args{'Callback'}? $args{'Callback'}->($_): $_}
+ grep {!defined( $wflags ) || ($_->Flags & $wflags) == $wflags}
+ grep {!defined( $woflags ) || !($_->Flags & $woflags)}
@{ $self->{'list'} };
}
diff --git a/lib/RT/Shredder/Plugin/Base.pm b/lib/RT/Shredder/Plugin/Base.pm
index 0cc4401..7092203 100644
--- a/lib/RT/Shredder/Plugin/Base.pm
+++ b/lib/RT/Shredder/Plugin/Base.pm
@@ -123,7 +123,7 @@ sub HasSupportForArgs
my @args = @_;
my @unsupported = ();
foreach my $arg ( @args ) {
- push @unsupported, $arg unless grep $_ eq $arg, $self->SupportArgs;
+ push @unsupported, $arg unless grep {$_ eq $arg} $self->SupportArgs;
}
return( 1 ) unless @unsupported;
return( 0, "Plugin doesn't support argument(s): @unsupported" ) if @unsupported;
diff --git a/lib/RT/Shredder/Plugin/Base/Search.pm b/lib/RT/Shredder/Plugin/Base/Search.pm
index 8dc5efa..d2d92d3 100644
--- a/lib/RT/Shredder/Plugin/Base/Search.pm
+++ b/lib/RT/Shredder/Plugin/Base/Search.pm
@@ -76,7 +76,7 @@ sub SupportArgs
{
my %seen;
my @args = sort
- grep $_ && !$seen{$_},
+ grep {$_ && !$seen{$_}}
shift->SUPER::SupportArgs(@_),
qw(limit);
return @args;
diff --git a/lib/RT/Shredder/Plugin/Objects.pm b/lib/RT/Shredder/Plugin/Objects.pm
index bef8ee1..9b8e1a9 100644
--- a/lib/RT/Shredder/Plugin/Objects.pm
+++ b/lib/RT/Shredder/Plugin/Objects.pm
@@ -85,7 +85,7 @@ sub TestArgs
my $list = $args{$name};
$list = [$list] unless ref($list) eq 'ARRAY';
- push @strings, map "RT::$name\-$_", @$list;
+ push @strings, map { "RT::$name\-$_" } @$list;
}
my @objs = RT::Shredder->CastObjectsToRecords( Objects => \@strings );
diff --git a/lib/RT/Shredder/Plugin/Summary.pm b/lib/RT/Shredder/Plugin/Summary.pm
index 6535a6b..3e24df2 100644
--- a/lib/RT/Shredder/Plugin/Summary.pm
+++ b/lib/RT/Shredder/Plugin/Summary.pm
@@ -128,8 +128,9 @@ sub WriteDownTransaction {
if $props->{'ObjectId'};
return 1 if $skip_refs_to{ $props->{'Object'} };
- delete $props->{$_} foreach grep
- !defined $props->{$_} || $props->{$_} eq '', keys %$props;
+ delete $props->{$_} for
+ grep {!defined $props->{$_} || $props->{$_} eq ''}
+ keys %$props;
return $self->_WriteDownHash( $args{'Object'}, $props );
}
@@ -149,7 +150,7 @@ sub WriteDownScrip {
sub _MakeHash {
my ($self, $obj) = @_;
my $hash = $self->__MakeHash( $obj );
- foreach (grep exists $hash->{$_}, qw(Creator LastUpdatedBy)) {
+ foreach (grep {exists $hash->{$_}} qw(Creator LastUpdatedBy)) {
my $method = $_ .'Obj';
my $u = $obj->$method();
$hash->{ $_ } = $u->EmailAddress || $u->Name || $u->_AsString;
diff --git a/lib/RT/System.pm b/lib/RT/System.pm
index 13375f5..fbb7474 100755
--- a/lib/RT/System.pm
+++ b/lib/RT/System.pm
@@ -193,7 +193,7 @@ sub SubjectTag {
return $map->{ $queue->id } if $queue;
my %seen = ();
- return grep !$seen{lc $_}++, values %$map;
+ return grep {!$seen{lc $_}++} values %$map;
}
RT::Base->_ImportOverlays();
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 64b391d..6b5a65c 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -405,9 +405,9 @@ sub bootstrap_plugins {
return $cwd if $args{'testing'} && $name eq $args{'testing'};
- if ( grep $name eq $_, @plugins ) {
- my $variants = join "(?:|::|-|_)", map "\Q$_\E", split /::/, $name;
- my ($path) = map $ENV{$_}, grep /^CHIMPS_(?:$variants).*_ROOT$/i, keys %ENV;
+ if ( grep {$name eq $_} @plugins ) {
+ my $variants = join "(?:|::|-|_)", map { "\Q$_\E" } split /::/, $name;
+ my ($path) = map { $ENV{$_} } grep {/^CHIMPS_(?:$variants).*_ROOT$/i} keys %ENV;
return $path if $path;
}
return $old_func->(@_);
@@ -795,7 +795,7 @@ sub mailsent_ok {
my $class = shift;
my $expected = shift;
- my $mailsent = scalar grep /\S/, split /%% split me! %%\n/,
+ my $mailsent = scalar grep {/\S/} split /%% split me! %%\n/,
RT::Test->file_content(
$tmp{'mailbox'},
'unlink' => 0,
@@ -815,7 +815,7 @@ sub set_mail_catcher {
sub fetch_caught_mails {
my $self = shift;
- return grep /\S/, split /%% split me! %%\n/,
+ return grep {/\S/} split /%% split me! %%\n/,
RT::Test->file_content(
$tmp{'mailbox'},
'unlink' => 1,
@@ -1076,7 +1076,7 @@ sub apache_server_info {
$res{'modules'} = [
map {my $mod = $_; $mod =~ s/^\s+//; $mod =~ s/\s+$//; $mod}
- grep $_ !~ /Compiled in modules/i,
+ grep {$_ !~ /Compiled in modules/i}
split /\r*\n/, `$bin -l`
];
@@ -1095,7 +1095,7 @@ sub apache_mod_perl_server_options {
$current->{'load_modules'} = '';
foreach my $mod ( @mlist ) {
- next if grep $_ =~ /^(mod_|)$mod\.c$/, @{ $info{'modules'} };
+ next if grep {$_ =~ /^(mod_|)$mod\.c$/} @{ $info{'modules'} };
$current->{'load_modules'} .=
"LoadModule ${mod}_module modules/mod_${mod}.so\n";
@@ -1115,7 +1115,7 @@ sub apache_fastcgi_server_options {
$current->{'load_modules'} = '';
foreach my $mod ( @mlist ) {
- next if grep $_ =~ /^(mod_|)$mod\.c$/, @{ $info{'modules'} };
+ next if grep {$_ =~ /^(mod_|)$mod\.c$/} @{ $info{'modules'} };
$current->{'load_modules'} .=
"LoadModule ${mod}_module modules/mod_${mod}.so\n";
@@ -1125,8 +1125,8 @@ sub apache_fastcgi_server_options {
sub find_apache_server {
my $self = shift;
- return $_ foreach grep defined,
- map $self->find_executable($_),
+ return $_ foreach grep {defined}
+ map {$self->find_executable($_)}
qw(httpd apache apache2 apache1);
return undef;
}
@@ -1241,7 +1241,7 @@ END {
RT::Test->stop_server;
# not success
- if ( !$Test->summary || grep !$_, $Test->summary ) {
+ if ( !$Test->summary || grep {!$_} $Test->summary ) {
$tmp{'directory'}->unlink_on_destroy(0);
Test::More::diag(
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 7d2b46d..b157940 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -2616,7 +2616,7 @@ sub Merged {
VALUE => $id,
);
return @{ $MERGE_CACHE{'merged'}{ $id } ||= [] }
- = map $_->id, @{ $mergees->ItemsArrayRef || [] };
+ = map { $_->id } @{ $mergees->ItemsArrayRef || [] };
}
# }}}
@@ -3166,7 +3166,9 @@ sub _ApplyTransactionBatch {
my $batch = $self->TransactionBatch;
my %seen;
- my $types = join ',', grep !$seen{$_}++, grep defined, map $_->__Value('Type'), grep defined, @{$batch};
+ my $types = join ',', grep {defined and not $seen{$_}++}
+ map {$_->__Value('Type')}
+ grep {defined} @{$batch};
require RT::Scrips;
RT::Scrips->new($RT::SystemUser)->Apply(
diff --git a/lib/RT/Tickets_Overlay.pm b/lib/RT/Tickets_Overlay.pm
index c4189de..37ea1fc 100755
--- a/lib/RT/Tickets_Overlay.pm
+++ b/lib/RT/Tickets_Overlay.pm
@@ -295,7 +295,7 @@ sub _IdLimit {
my $tmp = $sb->CurrentUser->UserObj->FirstAttribute('Bookmarks');
$tmp = $tmp->Content if $tmp;
$tmp ||= {};
- grep $_, keys %$tmp;
+ grep {$_} keys %$tmp;
};
return $sb->_SQLLimit(
@@ -2995,7 +2995,7 @@ sub CurrentUserCanSee {
foreach my $role ( keys %roles ) {
next unless ref $roles{ $role };
- my @queues = grep !$skip{$_}, @{ $roles{ $role } };
+ my @queues = grep {!$skip{$_}} @{ $roles{ $role } };
if ( @queues ) {
$roles{ $role } = \@queues;
} else {
@@ -3009,7 +3009,7 @@ sub CurrentUserCanSee {
# the idea here is that if the right is set globaly for a role
# and user plays this role for a queue directly not a ticket
# then we have to check in advance
- if ( my @tmp = grep $_ ne 'Owner' && !ref $roles{ $_ }, keys %roles ) {
+ if ( my @tmp = grep {$_ ne 'Owner' && !ref $roles{ $_ }} keys %roles ) {
my $groups = RT::Groups->new( $RT::SystemUser );
$groups->Limit( FIELD => 'Domain', VALUE => 'RT::Queue-Role' );
@@ -3184,10 +3184,9 @@ to.
sub RestrictionValues {
my $self = shift;
my $field = shift;
- return map $self->{'TicketRestrictions'}{$_}{'VALUE'}, grep {
- $self->{'TicketRestrictions'}{$_}{'FIELD'} eq $field
- && $self->{'TicketRestrictions'}{$_}{'OPERATOR'} eq "="
- }
+ return map {$self->{'TicketRestrictions'}{$_}{'VALUE'}}
+ grep { $self->{'TicketRestrictions'}{$_}{'FIELD'} eq $field
+ && $self->{'TicketRestrictions'}{$_}{'OPERATOR'} eq "=" }
keys %{ $self->{'TicketRestrictions'} };
}
diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index 284c888..48da0db 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -606,7 +606,7 @@ sub EmailFrequency {
&& $self->id != $RT::SystemUser->id;
return 'no email' unless my $email = $self->EmailAddress;
return 'squelched' if $args{'Ticket'} &&
- grep lc $email eq lc $_->Content, $args{'Ticket'}->SquelchMailTo;
+ grep {lc $email eq lc $_->Content} $args{'Ticket'}->SquelchMailTo;
my $frequency = RT->Config->Get( 'EmailFrequency', $self ) || '';
return 'daily' if $frequency =~ /daily/i;
return 'weekly' if $frequency =~ /weekly/i;
diff --git a/lib/RT/Users_Overlay.pm b/lib/RT/Users_Overlay.pm
index 79ae709..edbdcbc 100755
--- a/lib/RT/Users_Overlay.pm
+++ b/lib/RT/Users_Overlay.pm
@@ -351,7 +351,7 @@ sub _GetEquivObjects
push @objects, 'RT::System';
}
push @objects, @{ $args{'EquivObjects'} };
- return grep $_, @objects;
+ return grep {$_} @objects;
}
# XXX: should be generalized
@@ -426,7 +426,7 @@ sub WhoHaveRoleRight
VALUE => $RT::SystemUser->id
);
- $self->_AddSubClause( "WhichRole", "(". join( ' OR ', map "$groups.Type = '$_'", @roles ) .")" );
+ $self->_AddSubClause( "WhichRole", "(". join( ' OR ', map { "$groups.Type = '$_'" } @roles ) .")" );
my @groups_clauses = $self->_RoleClauses( $groups, @objects );
$self->_AddSubClause( "WhichObject", "(". join( ' OR ', @groups_clauses ) .")" )
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index 632064b..f628449 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -322,7 +322,7 @@ sub update {
$Lexicon{$str} ||= '';
}
foreach ( sort keys %Lexicon ) {
- my $f = join ( ' ', sort map $_->[0].":".$_->[1], @{ $FILECAT->{$_} } );
+ my $f = join ( ' ', sort map { $_->[0].":".$_->[1] } @{ $FILECAT->{$_} } );
my $nospace = $_;
$nospace =~ s/ +$//;
diff --git a/sbin/rt-dump-database.in b/sbin/rt-dump-database.in
index a500269..e1cd8cd 100755
--- a/sbin/rt-dump-database.in
+++ b/sbin/rt-dump-database.in
@@ -150,7 +150,7 @@ foreach my $class (@classes) {
delete $rv->{Disabled} unless $rv->{Disabled};
foreach my $record (map { /ACL/ ? 'ACE' : substr($_, 0, -1) } @classes) {
- foreach my $key (map "$record$_", ('', 'Id')) {
+ foreach my $key (map { "$record$_" } ('', 'Id')) {
next unless exists $rv->{$key};
my $id = $rv->{$key} or next;
my $obj = "RT::$record"->new($RT::SystemUser);
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index 5c84f16..3223b20 100755
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -357,7 +357,7 @@ sub __add
my @cur = argument_to_list( $action );
my $id = $obj->id;
- return if grep $_ == $id, @cur;
+ return if grep { $_ == $id } @cur;
push @cur, $id;
@@ -386,7 +386,7 @@ sub delete_action {
push @sid, $s->id;
}
print STDERR "ScripAction '". $opts->{'name'} ."'"
- . " is in use by Scrip(s) ". join( ", ", map "#$_", @sid )
+ . " is in use by Scrip(s) ". join( ", ", map { "#$_" } @sid )
. "\n";
exit(-1);
}
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 626443d..280e192 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -104,7 +104,7 @@ unless ( $args{'action'} ) {
}
# check and setup @actions
-my @actions = grep $_, split /,/, $args{'action'};
+my @actions = grep {$_} split /,/, $args{'action'};
if ( @actions > 1 && $args{'datafile'} ) {
print STDERR "You can not use --datafile option with multiple actions.\n";
exit(-1);
@@ -273,7 +273,7 @@ sub action_upgrade {
unless @versions;
print "\nGoing to apply following upgrades:\n";
- print map "* $_\n", @versions;
+ print map { "* $_\n" } @versions;
{
my $custom_upgrading_to = undef;
@@ -311,7 +311,7 @@ sub action_upgrade {
unless @versions;
print "\nGoing to apply following upgrades:\n";
- print map "* $_\n", @versions;
+ print map { "* $_\n" } @versions;
}
}
@@ -338,12 +338,12 @@ sub get_versions_from_to {
my ($base_dir, $from, $to) = @_;
opendir( my $dh, $base_dir ) or die "couldn't open dir: $!";
- my @versions = grep -d "$base_dir/$_" && /\d+\.\d+\.\d+/, readdir $dh;
+ my @versions = grep {-d "$base_dir/$_" && /\d+\.\d+\.\d+/} readdir $dh;
closedir $dh;
return
- grep RT::Handle::cmp_version($_, $to) <= 0,
- grep RT::Handle::cmp_version($_, $from) > 0,
+ grep { RT::Handle::cmp_version($_, $to) <= 0 }
+ grep { RT::Handle::cmp_version($_, $from) > 0 }
sort RT::Handle::cmp_version @versions;
}
diff --git a/sbin/rt-shredder.in b/sbin/rt-shredder.in
index ba8d5cb..685a439 100755
--- a/sbin/rt-shredder.in
+++ b/sbin/rt-shredder.in
@@ -303,7 +303,7 @@ sub _process_dump_plugin {
sub show_plugin_list
{
print "Plugins list:\n";
- print "\t$_\n" foreach( grep !/^Base$/, keys %plugins );
+ print "\t$_\n" foreach( grep {!/^Base$/} keys %plugins );
exit(1);
}
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 3892733..3bd733a 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -97,7 +97,7 @@ my %default = (
'with-GD' => @RT_GD@,
'with-DASHBOARDS' => 1
);
-$args{$_} = $default{$_} foreach grep !exists $args{$_}, keys %default;
+$args{$_} = $default{$_} foreach grep {!exists $args{$_}} keys %default;
{
my $section;
@@ -397,7 +397,7 @@ check_perl_version();
check_users();
my %Missing_By_Type = ();
-foreach my $type (sort grep $args{$_}, keys %args) {
+foreach my $type (sort grep {$args{$_}} keys %args) {
next unless ($type =~ /^with-(.*?)$/);
$type = $1;
@@ -460,7 +460,7 @@ sub test_dep {
if ( $avoid ) {
my $version = $module->VERSION;
- if ( grep $version eq $_, @$avoid ) {
+ if ( grep {$version eq $_} @$avoid ) {
return 0 unless wantarray;
return (0, "It's known that there are problems with RT and version '$version' of '$module' module. If it's the latest available version of the module then you have to downgrade manually.");
}
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 7219708..10afc08 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -893,7 +893,7 @@ push @CHECKS, 'LastUpdatedBy and Creator' => sub {
};
my %CHECKS = @CHECKS;
- at do_check = do { my $i = 1; grep $i++%2, @CHECKS };
+ at do_check = do { my $i = 1; grep {$i++%2} @CHECKS };
while ( my $check = shift @do_check ) {
$CHECKS{ $check }->();
@@ -901,7 +901,7 @@ while ( my $check = shift @do_check ) {
foreach my $redo ( keys %redo_check ) {
die "check $redo doesn't exist" unless $CHECKS{ $redo };
delete $redo_check{ $redo };
- next if grep $_ eq $redo, @do_check; # don't do twice
+ next if grep {$_ eq $redo} @do_check; # don't do twice
push @do_check, $redo;
}
}
@@ -917,14 +917,14 @@ sub check_integrity {
print "Checking integrity of $stable.{". join(', ', @scols) ."} => $ttable.{". join(', ', @tcols) ."}\n"
if $opt{'verbose'};
- my $query = "SELECT s.id, ". join(', ', map "s.$_", @scols)
+ my $query = "SELECT s.id, ". join(', ', map { "s.$_" } @scols)
." FROM $stable s LEFT JOIN $ttable t"
." ON (". join(
- ' AND ', map columns_eq_cond('s', $stable, $scols[$_] => 't', $ttable, $tcols[$_]), (0..(@scols-1))
+ ' AND ', map { columns_eq_cond('s', $stable, $scols[$_] => 't', $ttable, $tcols[$_]) } (0..(@scols-1))
) .")"
. ($args{'join_condition'}? " AND ( $args{'join_condition'} )": "")
." WHERE t.id IS NULL"
- ." AND ". join(' AND ', map "s.$_ IS NOT NULL", @scols);
+ ." AND ". join(' AND ', map { "s.$_ IS NOT NULL" } @scols);
$query .= " AND ( $args{'condition'} )" if $args{'condition'};
@@ -985,7 +985,7 @@ sub check_uniqueness {
my @columns = @{ $args{'columns'} };
- print "Checking uniqueness of ( ", join(', ', map "'$_'", @columns )," ) in table '$on'\n"
+ print "Checking uniqueness of ( ", join(', ', map { "'$_'" } @columns )," ) in table '$on'\n"
if $opt{'versbose'};
my ($scond, $tcond);
@@ -994,12 +994,12 @@ sub check_uniqueness {
$tcond =~ s/(\s|^)\./$1t./g;
}
- my $query = "SELECT s.id, t.id, ". join(', ', map "s.$_", @columns)
+ my $query = "SELECT s.id, t.id, ". join(', ', map { "s.$_" } @columns)
." FROM $on s LEFT JOIN $on t "
- ." ON s.id != t.id AND ". join(' AND ', map "s.$_ = t.$_", @columns)
+ ." ON s.id != t.id AND ". join(' AND ', map { "s.$_ = t.$_" } @columns)
. ($tcond? " AND ( $tcond )": "")
." WHERE t.id IS NOT NULL "
- ." AND ". join(' AND ', map "s.$_ IS NOT NULL", @columns);
+ ." AND ". join(' AND ', map { "s.$_ IS NOT NULL" } @columns);
$query .= " AND ( $scond )" if $scond;
my $sth = execute_query(
@@ -1047,8 +1047,8 @@ sub update_records {
while ( my ($k, $v) = each %$what ) { push @what_cols, $k; push @what_binds, $v; }
print "Updating record(s) in $table\n" if $opt{'verbose'};
- my $query = "UPDATE $table SET ". join(', ', map "$_ = ?", @what_cols)
- ." WHERE ". join(' AND ', map "$_ = ?", @where_cols);
+ my $query = "UPDATE $table SET ". join(', ', map { "$_ = ?" } @what_cols)
+ ." WHERE ". join(' AND ', map { "$_ = ?" } @where_cols);
$redo_check{ $_ } = 1 foreach @{ $redo_on{'Update'}{ $table } || [] };
return execute_query( $query, @what_binds, @where_binds );
}
@@ -1096,7 +1096,7 @@ sub prompt_action {
my $input = <STDIN>;
chomp $input;
return $cached_answer{ $token } = '' unless $input;
- foreach ( grep rindex(lc $_, lc $input, 0) == 0, @$actions ) {
+ foreach ( grep {rindex(lc $_, lc $input, 0) == 0} @$actions ) {
return $cached_answer{ $token } = lc substr $input, 0, 1;
}
return $cached_answer{ $token } = '';
commit 2253227e46fa9a5c1dc94d1ae0559eef7e8bfe28
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Aug 23 15:31:24 2011 -0400
Remove unused RT::Interface::Web::FCGI::Server inline package
This was originally inserted for extensibility, but never used; simply
replace it with the equivilent FCGI::ProcManager.
diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index b55311a..f3a859e 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -160,10 +160,6 @@ Server config:
use strict;
use warnings;
-package RT::Interface::Web::FCGI::Server;
-use base qw(FCGI::ProcManager);
-
-package main;
use Getopt::Long;
@@ -209,8 +205,8 @@ $ENV{'FCGI_SOCKET_PATH'} = $opt{'socket'};
$opt{'pidfile'} ||= File::Spec->catfile($RT::VarPath, 'fastcgi.pid');
require CGI::Fast;
-
-my $proc_manager = RT::Interface::Web::FCGI::Server->new({
+require FCGI::ProcManager;
+my $proc_manager = FCGI::ProcManager->new({
n_processes => $opt{'nprocesses'} || 10,
pid_fname => $opt{'pidfile'},
});
commit 5af498d56dfb756ab086895e84e13641276318af
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Aug 23 20:10:18 2011 -0400
f60def07 removed rewrite argument rewriting in GPG probe, which is necessary
Removing the call to _PrepareGnuPGOptions causes failures, as there is
no "no-permission-warning" method.
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 14cc224..b04dc43 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -2029,7 +2029,9 @@ properly (and false otherwise).
sub Probe {
my $gnupg = GnuPG::Interface->new;
- $gnupg->options->hash_init( RT->Config->Get('GnuPGOptions') );
+ $gnupg->options->hash_init(
+ _PrepareGnuPGOptions( RT->Config->Get('GnuPGOptions') ),
+ );
$gnupg->options->meta_interactive( 0 );
my ($handles, $handle_list) = _make_gpg_handles();
commit 369d362977d6f8f01b5fc4dd2b309ee37241e2fb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Aug 23 21:12:34 2011 -0400
Remove unnecessary package statements, unused global variables
diff --git a/bin/webmux.pl.in b/bin/webmux.pl.in
index 97f9d38..87c3355 100755
--- a/bin/webmux.pl.in
+++ b/bin/webmux.pl.in
@@ -55,17 +55,10 @@ local $ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
local $ENV{'ENV'} = '' if defined $ENV{'ENV'};
local $ENV{'IFS'} = '' if defined $ENV{'IFS'};
-package HTML::Mason::Commands;
-our %session;
-
-package RT::Mason;
-
-our ($Nobody, $SystemUser, $Handler, $r);
-
my $protect_fd;
-sub handler {
- ($r) = @_;
+sub RT::Mason::handler {
+ my ($r) = @_;
if ( !$protect_fd && $ENV{'MOD_PERL'} && exists $ENV{'MOD_PERL_API_VERSION'}
&& $ENV{'MOD_PERL_API_VERSION'} >= 2 && fileno(STDOUT) != 1
@@ -110,21 +103,18 @@ sub handler {
return 400;
}
- my (%session, $status);
+ my ($status);
{
local $@ = undef;
- $status = eval { $Handler->handle_request($r) };
+ $status = eval { $RT::Mason::Handler->handle_request($r) };
$RT::Logger->crit( $@ ) if $@;
}
- undef %session;
RT::Interface::Web::Handler->CleanupRequest();
return $status;
}
-package main;
-
# check mod_perl version if it's mod_perl
BEGIN {
die "RT does not support mod_perl 1.99. Please upgrade to mod_perl 2.0"
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list