[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-26-g17523fc
Alex Vandiver
alexmv at bestpractical.com
Wed Jun 29 17:05:40 EDT 2011
The branch, 3.8/perlcritic has been updated
via 17523fc47ff32fe071f5e0a615fa8ab2ec682974 (commit)
via 59e0a09c002582f844b5e414a88e186691ab2f9c (commit)
via f2ab1b1f2cc7288f5b73f4136711f79d82815492 (commit)
from cbec28a59298dcab9095f419f3597986eb10ebc7 (commit)
Summary of changes:
bin/rt.in | 9 ++++++---
lib/RT/URI.pm | 11 ++++-------
sbin/rt-email-group-admin.in | 2 +-
3 files changed, 11 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit f2ab1b1f2cc7288f5b73f4136711f79d82815492
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jun 29 16:53:43 2011 -0400
Use the bare minimal string-eval to require the class
diff --git a/lib/RT/URI.pm b/lib/RT/URI.pm
index facce04..06de429 100755
--- a/lib/RT/URI.pm
+++ b/lib/RT/URI.pm
@@ -172,14 +172,11 @@ sub _GetResolver {
my $scheme = shift;
$scheme =~ s/(\.|-)/_/g;
- my $resolver;
-
- eval "
- require RT::URI::$scheme;
- \$resolver = RT::URI::$scheme->new(\$self->CurrentUser);
- ";
-
+ my $class = "RT::URI::$scheme";
+ eval "require $class";
+ my $resolver = eval { $class->new($self->CurrentUser); };
+
if ($resolver) {
$self->{'resolver'} = $resolver;
} else {
commit 59e0a09c002582f844b5e414a88e186691ab2f9c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jun 29 16:54:01 2011 -0400
Use ->can() to dispatch, rather than a string eval
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index 6004860..125ba3f 100755
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -193,7 +193,7 @@ sub usage {
parse_args();
{
- eval "main::$cmd()";
+ main->can($cmd)->();
if ( $@ ) {
print STDERR $@ ."\n";
}
commit 17523fc47ff32fe071f5e0a615fa8ab2ec682974
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jun 29 17:04:35 2011 -0400
Fix scoping of filehandles
diff --git a/bin/rt.in b/bin/rt.in
index 2c84e0c..e33253b 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1165,7 +1165,8 @@ sub submit {
my ($self, $file) = @_;
$file ||= $self->{file};
- open(my $f, '<', $file) && do {
+ my $f;
+ open($f, '<', $file) && do {
$self->{file} = $file;
my $sids = $self->{sids} = {};
while (<$f>) {
@@ -1185,7 +1186,8 @@ sub submit {
my ($self, $file) = shift;
$file ||= $self->{file};
- open(my $f, '>', $file) && do {
+ my $f;
+ open($f, '>', $file) && do {
my $sids = $self->{sids};
foreach my $server (keys %$sids) {
foreach my $user (keys %{ $sids->{$server} }) {
@@ -1427,7 +1429,8 @@ sub parse_config_file {
my ($file) = @_;
local $_; # $_ may be aliased to a constant, from line 1163
- open(my $cfg, '<', $file) && do {
+ my $cfg;
+ open($cfg, '<', $file) && do {
while (<$cfg>) {
chomp;
next if (/^#/ || /^\s*$/);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list