[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-44-gdbcda6b
Alex Vandiver
alexmv at bestpractical.com
Tue Jul 5 16:18:59 EDT 2011
The branch, 3.8/perlcritic has been updated
via dbcda6b95941c6f7e1f25464c8f318774f4e2ea9 (commit)
from f63ccd9b3ad29ecf19fea5e618430c671f38ef78 (commit)
Summary of changes:
lib/RT/Config.pm | 8 ++++----
lib/RT/I18N.pm | 9 +++++----
share/html/Admin/Tools/Configuration.html | 10 +++++-----
3 files changed, 14 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit dbcda6b95941c6f7e1f25464c8f318774f4e2ea9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Jul 5 16:11:36 2011 -0400
Make all "no strict" usages be scoped to a single line
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 67bcecf..6d18070 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -844,11 +844,11 @@ sub SetFromConfig {
HASH => '%',
CODE => '&',
);
- no strict 'refs';
my $name = undef;
# scan $pack's nametable(hash)
- foreach my $k ( keys %{$pack} ) {
+ my %package = do { no strict 'refs'; %{$pack} };
+ foreach my $k ( keys %package ) {
# hash for main:: has reference on itself
next if $k eq 'main::';
@@ -863,7 +863,7 @@ sub SetFromConfig {
# entry of the table with references to
# SCALAR, ARRAY... and other types with
# the same name
- my $entry = ${$pack}{$k};
+ my $entry = $package{$k};
next unless $entry;
# get entry for type we are looking for
@@ -871,7 +871,7 @@ sub SetFromConfig {
# Otherwie 5.10 goes boom. maybe we should skip any
# reference
next if ref($entry) eq 'SCALAR' || ref($entry) eq 'REF';
- my $entry_ref = *{$entry}{ ref($ref) };
+ my $entry_ref = do {no strict 'refs'; *{$entry}{ ref($ref) } };
next unless $entry_ref;
# if references are equal then we've found
diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index 2056b3e..0164448 100755
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -130,13 +130,14 @@ sub Init {
sub LoadLexicons {
- no strict 'refs';
- foreach my $k (keys %{RT::I18N::} ) {
+ my %package = do {no strict 'refs'; %{RT::I18N::} };
+ foreach my $k (keys %package) {
next if $k eq 'main::';
next unless index($k, '::', -2) >= 0;
- next unless exists ${ 'RT::I18N::'. $k }{'Lexicon'};
+ my %lang_package = do {no strict 'refs'; %{'RT::I18N::'. $k} };
+ next unless exists $lang_package{'Lexicon'};
- my $lex = *{ ${'RT::I18N::'. $k }{'Lexicon'} }{HASH};
+ my $lex = *{ $lang_package{'Lexicon'} }{HASH};
# run fetch to force load
my $tmp = $lex->{'foo'};
# XXX: untie may fail with "untie attempted
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index f4c648a..9b0eaf6 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -123,11 +123,12 @@ foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
<th class="collection-as-table"><&|/l&>Value</&></th>
</tr>
<%PERL>
-{ no strict qw/refs/;
my %config_opt = map { $_ => 1 } RT->Config->Options( Overridable => undef );
my $index_var;
-foreach my $key ( sort keys %{*RT::} ) {
- next if !${'RT::'.$key} || ref ${'RT::'.$key} || $config_opt{ $key };
+my %package = do {no strict 'refs'; %{*RT::} };
+foreach my $key ( sort keys %package ) {
+ my $val = do {no strict 'refs'; ${'RT::'.$key} };
+ next if !$val || ref $val || $config_opt{ $key };
$index_var++;
</%PERL>
<tr class="collection-as-table <% $index_var%2 ? 'oddline' : 'evenline'%>">
@@ -136,12 +137,11 @@ foreach my $key ( sort keys %{*RT::} ) {
% if ( $key =~ /Password(?!Length)/i ) {
<em>Password not printed</em>
% } else {
-<% ${'RT::'.$key} %>
+<% $val %>
% }
</td>
</tr>
% }
-% }
</table>
</&>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list