[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-180-ge2813c7

Thomas Sibley trs at bestpractical.com
Mon Jul 25 15:47:25 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  e2813c7027f82c70b79db2d5c85d09795e434423 (commit)
      from  1322430cedd04a25855b2e77138add9f884a54cf (commit)

Summary of changes:
 bin/fastcgi_server.in                              |    2 +-
 bin/mason_handler.fcgi.in                          |    2 +-
 bin/rt-mailgate.in                                 |    4 +-
 bin/rt.in                                          |    2 +-
 bin/webmux.pl.in                                   |    6 ++--
 lib/RT.pm.in                                       |    6 ++--
 lib/RT/Attachment_Overlay.pm                       |    2 +-
 lib/RT/Condition/UserDefined.pm                    |    2 +-
 lib/RT/Config.pm                                   |    4 +-
 lib/RT/Crypt/GnuPG.pm                              |   30 ++++++++++----------
 lib/RT/CustomField_Overlay.pm                      |    2 +-
 lib/RT/EmailParser.pm                              |    2 +-
 lib/RT/Handle.pm                                   |   12 +++----
 lib/RT/Installer.pm                                |    2 +-
 lib/RT/Interface/Email.pm                          |    4 +-
 lib/RT/Interface/Web.pm                            |    4 +-
 lib/RT/Interface/Web/Session.pm                    |    6 ++--
 lib/RT/Record.pm                                   |    2 +-
 lib/RT/SQL.pm                                      |    2 +-
 lib/RT/Shredder/Plugin.pm                          |    2 +-
 lib/RT/Test.pm                                     |   12 ++++----
 lib/RT/Ticket_Overlay.pm                           |    2 +-
 lib/RT/Tickets_Overlay_SQL.pm                      |    2 +-
 sbin/extract-message-catalog                       |    2 +-
 sbin/rt-email-group-admin.in                       |    2 +-
 .../Admin/Elements/EditCustomFieldValuesSource     |    2 +-
 share/html/Install/index.html                      |    2 +-
 27 files changed, 60 insertions(+), 62 deletions(-)

- Log -----------------------------------------------------------------
commit e2813c7027f82c70b79db2d5c85d09795e434423
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Jul 25 14:28:15 2011 -0400

    Explicitly initialize local'd variables to undef or another appropriate value

diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index ac241e8..b55311a 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -249,7 +249,7 @@ while ( my $cgi = CGI::Fast->new ) {
         $cgi->path_info( $cgi->path_info . "/index.html" );
     }
 
-    local $@;
+    local $@ = undef;
     eval { $RT::Mason::Handler->handle_cgi_object($cgi); };
     if ($@) {
         $RT::Logger->crit($@);
diff --git a/bin/mason_handler.fcgi.in b/bin/mason_handler.fcgi.in
index aa36754..d435248 100755
--- a/bin/mason_handler.fcgi.in
+++ b/bin/mason_handler.fcgi.in
@@ -86,7 +86,7 @@ while ( my $cgi = CGI::Fast->new ) {
         $cgi->path_info( $cgi->path_info . "/index.html" );
     }
 
-    local $@;
+    local $@ = undef;
     eval { $RT::Mason::Handler->handle_cgi_object($cgi); };
     if ($@) {
         $RT::Logger->crit($@);
diff --git a/bin/rt-mailgate.in b/bin/rt-mailgate.in
index cb05e58..c07888f 100755
--- a/bin/rt-mailgate.in
+++ b/bin/rt-mailgate.in
@@ -180,13 +180,13 @@ sub check_failure {
 sub write_down_message {
     use File::Temp qw(tempfile);
 
-    local $@;
+    local $@ = undef;
     my ($fh, $filename) = eval { tempfile() };
     if ( !$fh || $@ ) {
         print STDERR "$0: Couldn't create temp file, using memory\n";
         print STDERR "error: $@\n" if $@;
 
-        my $message = \do { local (@ARGV, $/); <STDIN> };
+        my $message = \do { local (@ARGV, $/) = ((), undef); <STDIN> };
         unless ( $$message =~ /\S/ ) {
             print STDERR "$0: no message passed on STDIN\n";
             exit 0;
diff --git a/bin/rt.in b/bin/rt.in
index f669e33..218ad5d 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1448,7 +1448,7 @@ sub config_from_file {
 sub parse_config_file {
     my %cfg;
     my ($file) = @_;
-    local $_; # $_ may be aliased to a constant, from line 1163
+    local $_ = undef; # $_ may be aliased to a constant, from line 1163
 
     my $cfg;
     open($cfg, '<', $file) or return;
diff --git a/bin/webmux.pl.in b/bin/webmux.pl.in
index 4b08f39..f4bb113 100755
--- a/bin/webmux.pl.in
+++ b/bin/webmux.pl.in
@@ -80,8 +80,8 @@ sub handler {
         }
     }
 
-    local $SIG{__WARN__};
-    local $SIG{__DIE__};
+    local $SIG{__WARN__} = undef;
+    local $SIG{__DIE__} = undef;
     RT::InitSignalHandlers();
 
     if ($r->content_type =~ m/^httpd\b.*\bdirectory/i) {
@@ -110,7 +110,7 @@ sub handler {
 
     my (%session, $status);
     {
-        local $@;
+        local $@ = undef;
         $status = eval { $Handler->handle_request($r) };
         $RT::Logger->crit( $@ ) if $@;
     }
diff --git a/lib/RT.pm.in b/lib/RT.pm.in
index 3e6082b..0cfd66d 100755
--- a/lib/RT.pm.in
+++ b/lib/RT.pm.in
@@ -379,7 +379,7 @@ sub CheckPerlRequirements {
     # use $error here so the following "die" can still affect the global $@
     my $error;
     {
-        local $@;
+        local $@ = undef;
         eval {
             my $x = '';
             my $y = \$x;
@@ -469,14 +469,14 @@ sub InitClasses {
         my $scrips = RT::Scrips->new($RT::SystemUser);
         $scrips->Limit( FIELD => 'Stage', OPERATOR => '!=', VALUE => 'Disabled' );
         while ( my $scrip = $scrips->Next ) {
-            local $@;
+            local $@ = undef;
             eval { $scrip->LoadModules } or
                 $RT::Logger->error("Invalid Scrip ".$scrip->Id.".  Unable to load the Action or Condition.  ".
                                    "You should delete or repair this Scrip in the admin UI.\n$@\n");
         }
 
 	foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) {
-            local $@;
+            local $@ = undef;
             eval "require $class; 1" or $RT::Logger->error(
                 "Class '$class' is listed in CustomFieldValuesSources option"
                 ." in the config, but we failed to load it:\n$@\n"
diff --git a/lib/RT/Attachment_Overlay.pm b/lib/RT/Attachment_Overlay.pm
index 3f25398..6603f06 100644
--- a/lib/RT/Attachment_Overlay.pm
+++ b/lib/RT/Attachment_Overlay.pm
@@ -309,7 +309,7 @@ sub OriginalContent {
     }
 
     # Turn *off* the SvUTF8 bits here so decode_utf8 and from_to below can work.
-    local $@;
+    local $@ = undef;
     Encode::_utf8_off($content);
 
     if (!$enc || $enc eq '' ||  $enc eq 'utf8' || $enc eq 'utf-8') {
diff --git a/lib/RT/Condition/UserDefined.pm b/lib/RT/Condition/UserDefined.pm
index fac3394..454c24d 100755
--- a/lib/RT/Condition/UserDefined.pm
+++ b/lib/RT/Condition/UserDefined.pm
@@ -59,7 +59,7 @@ This happens on every transaction. it's always applicable
 
 sub IsApplicable {
     my $self = shift;
-    local $@;
+    local $@ = undef;
     my $retval = eval $self->ScripObj->CustomIsApplicableCode;
     if ($@) {
         $RT::Logger->error("Scrip ".$self->ScripObj->Id. " IsApplicable failed: ".$@);
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 822491c..f434710 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -417,7 +417,7 @@ our %META = (
             my $value = shift;
             return if $value;
             return if $INC{'GraphViz.pm'};
-            local $@;
+            local $@ = undef;
             return if eval {require GraphViz; 1};
             $RT::Logger->debug("You've enabled GraphViz, but we couldn't load the module: $@");
             $self->Set( DisableGraphViz => 1 );
@@ -430,7 +430,7 @@ our %META = (
             my $value = shift;
             return if $value;
             return if $INC{'GD.pm'};
-            local $@;
+            local $@ = undef;
             return if eval {require GD; 1};
             $RT::Logger->debug("You've enabled GD, but we couldn't load the module: $@");
             $self->Set( DisableGD => 1 );
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 89450fd..d184ccb 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -489,7 +489,7 @@ sub SignEncryptRFC3156 {
 
         $res{'exit_code'} = $?;
         foreach ( qw(stderr logger status) ) {
-            $res{$_} = do { local $/; readline $handle{$_} };
+            $res{$_} = do { local $/ = undef; readline $handle{$_} };
             delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
             close $handle{$_};
         }
@@ -545,7 +545,7 @@ sub SignEncryptRFC3156 {
 
         $res{'exit_code'} = $?;
         foreach ( qw(stderr logger status) ) {
-            $res{$_} = do { local $/; readline $handle{$_} };
+            $res{$_} = do { local $/ = undef; readline $handle{$_} };
             delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
             close $handle{$_};
         }
@@ -670,7 +670,7 @@ sub _SignEncryptTextInline {
     my $err = $@;
 
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -757,7 +757,7 @@ sub _SignEncryptAttachmentInline {
     my $err = $@;
 
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -858,7 +858,7 @@ sub SignEncryptContent {
     my $err = $@;
 
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1130,7 +1130,7 @@ sub VerifyAttachment {
     };
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1177,7 +1177,7 @@ sub VerifyRFC3156 {
     };
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1242,7 +1242,7 @@ sub DecryptRFC3156 {
     };
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1406,7 +1406,7 @@ sub _DecryptInlineBlock {
     };
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1526,7 +1526,7 @@ sub DecryptContent {
     };
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -2106,7 +2106,7 @@ sub GetKeysInfo {
 
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -2307,7 +2307,7 @@ sub DeleteKey {
     my %res;
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -2350,7 +2350,7 @@ sub ImportKey {
     my %res;
     $res{'exit_code'} = $?;
     foreach ( qw(stderr logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -2417,7 +2417,7 @@ sub Probe {
     my ($handles, $handle_list) = _make_gpg_handles();
     my %handle = %$handle_list;
 
-    local $@;
+    local $@ = undef;
     eval {
         local $SIG{'CHLD'} = 'DEFAULT';
         my $pid = safe_run_child { $gnupg->wrap_call( commands => ['--version' ], handles => $handles ) };
@@ -2441,7 +2441,7 @@ sub Probe {
             . ($? & 127 ? (" as recieved signal ". ($? & 127)) : '')
             . ".";
         foreach ( qw(stderr logger status) ) {
-            my $tmp = do { local $/; readline $handle{$_} };
+            my $tmp = do { local $/ = undef; readline $handle{$_} };
             next unless $tmp && $tmp =~ /\S/s;
             close $handle{$_};
             $msg .= "\n$_:\n$tmp\n";
diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index 54015a1..35cf5db 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -638,7 +638,7 @@ sub _IsValidRegex {
     my $self  = shift;
     my $regex = shift or return (1, 'valid');
 
-    local $^W; local $@;
+    local $^W = undef; local $@ = undef;
     local $SIG{__DIE__} = sub { 1 };
     local $SIG{__WARN__} = sub { 1 };
 
diff --git a/lib/RT/EmailParser.pm b/lib/RT/EmailParser.pm
index 9fdf579..5a5d274 100755
--- a/lib/RT/EmailParser.pm
+++ b/lib/RT/EmailParser.pm
@@ -249,7 +249,7 @@ sub _DecodeBody {
     my $source = $old->open('r') or die "couldn't open body: $!";
     my $destination = $new->open('w') or die "couldn't open body: $!";
     { 
-        local $@;
+        local $@ = undef;
         eval { $decoder->decode($source, $destination) };
         $RT::Logger->error($@) if $@;
     }
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 3edfefc..f21826d 100755
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -431,7 +431,7 @@ sub InsertACL {
         $path = $base_path;
     }
 
-    local *acl;
+    local *acl = sub {};
     do $path || return (0, "Couldn't load ACLs: " . $@);
     my @acl = acl($dbh);
     foreach my $statement (@acl) {
@@ -738,11 +738,9 @@ sub InsertData {
 
     # Slurp in stuff to insert from the datafile. Possible things to go in here:-
     our (@Groups, @Users, @ACL, @Queues, @ScripActions, @ScripConditions,
-           @Templates, @CustomFields, @Scrips, @Attributes, @Initial, @Final);
-    local (@Groups, @Users, @ACL, @Queues, @ScripActions, @ScripConditions,
-           @Templates, @CustomFields, @Scrips, @Attributes, @Initial, @Final);
+           @Templates, @CustomFields, @Scrips, @Attributes, @Initial, @Final) = ();
 
-    local $@;
+    local $@ = undef;
     $RT::Logger->debug("Going to load '$datafile' data file");
     eval { require $datafile }
       or return (0, "Couldn't load data from '$datafile' for import:\n\nERROR:". $@);
@@ -750,7 +748,7 @@ sub InsertData {
     if ( @Initial ) {
         $RT::Logger->debug("Running initial actions...");
         foreach ( @Initial ) {
-            local $@;
+            local $@ = undef;
             eval { $_->(); 1 } or return (0, "One of initial functions failed: $@");
         }
         $RT::Logger->debug("Done.");
@@ -1039,7 +1037,7 @@ sub InsertData {
     if ( @Final ) {
         $RT::Logger->debug("Running final actions...");
         for ( @Final ) {
-            local $@;
+            local $@ = undef;
             eval { $_->(); };
             $RT::Logger->error( "Failed to run one of final actions: $@" )
                 if $@;
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index 0cf4d01..f4cd823 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -277,7 +277,7 @@ sub SaveConfig {
     my $content;
 
     {
-        local $/;
+        local $/ = undef;
         open( my $fh, '<', $file ) or die $!;
         $content = <$fh>;
         $content =~ s/^\s*1;\s*$//m;
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 88ac1da..1d34b98 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -472,7 +472,7 @@ sub SendEmail {
     }
     elsif ( $mail_command eq 'smtp' ) {
         require Net::SMTP;
-        my $smtp = do { local $@; eval { Net::SMTP->new(
+        my $smtp = do { local $@ = undef; eval { Net::SMTP->new(
             Host  => RT->Config->Get('SMTPServer'),
             Debug => RT->Config->Get('SMTPDebug'),
         ) } };
@@ -516,7 +516,7 @@ sub SendEmail {
         }
     }
     else {
-        local ($ENV{'MAILADDRESS'}, $ENV{'PERL_MAILERS'});
+        local ($ENV{'MAILADDRESS'}, $ENV{'PERL_MAILERS'}) = (undef, undef);
 
         my @mailer_args = ($mail_command);
         if ( $mail_command eq 'sendmail' ) {
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 0a23052..cc11c92 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -179,7 +179,7 @@ sub HandleRequest {
     MaybeEnableSQLStatementLog();
 
     # avoid reentrancy, as suggested by masonbook
-    local *HTML::Mason::Commands::session unless $HTML::Mason::Commands::m->is_subrequest;
+    local *HTML::Mason::Commands::session = {} unless $HTML::Mason::Commands::m->is_subrequest;
 
     $HTML::Mason::Commands::m->autoflush( $HTML::Mason::Commands::m->request_comp->attr('AutoFlush') )
         if ( $HTML::Mason::Commands::m->request_comp->attr_exists('AutoFlush') );
@@ -2247,7 +2247,7 @@ sub _UploadedFile {
 
     return {
         Value        => $filename,
-        LargeContent => do { local $/; scalar <$fh> },
+        LargeContent => do { local $/ = undef; scalar <$fh> },
         ContentType  => $upload_info->{'Content-Type'},
     };
 }
diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
index 4ba9eba..969a61b 100644
--- a/lib/RT/Interface/Web/Session.pm
+++ b/lib/RT/Interface/Web/Session.pm
@@ -215,7 +215,7 @@ sub _ClearOldDir {
         }
 
         my %session;
-        local $@;
+        local $@ = undef;
         eval { tie %session, $class, $id, $attrs };
         if( $@ ) {
             $RT::Logger->debug("skipped session '$id', couldn't load: $@");
@@ -242,7 +242,7 @@ sub ClearByUser {
     my %seen = ();
     foreach my $id( @{ $self->Ids } ) {
         my %session;
-        local $@;
+        local $@ = undef;
         eval { tie %session, $class, $id, $attrs };
         if( $@ ) {
             $RT::Logger->debug("skipped session '$id', couldn't load: $@");
@@ -269,7 +269,7 @@ sub TIEHASH {
 
     my %session;
 
-    local $@;
+    local $@ = undef;
     eval { tie %session, $class, $id, $attrs };
     eval { tie %session, $class, undef, $attrs } if $@;
     if ( $@ ) {
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 27fe7e9..7516443 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -890,7 +890,7 @@ sub Update {
         # and might not have a Name method. But "can" won't find autoloaded
         # items. If it fails, we don't care
         do {
-            local $@;
+            local $@ = undef;
 
             my $current = $self->$attribute();
             eval {
diff --git a/lib/RT/SQL.pm b/lib/RT/SQL.pm
index b5782b1..b172312 100644
--- a/lib/RT/SQL.pm
+++ b/lib/RT/SQL.pm
@@ -52,7 +52,7 @@ use strict;
 use warnings;
 
 use constant HAS_BOOLEAN_PARSER => do {
-    local $@;
+    local $@ = undef;
     eval { require Parse::BooleanLogic; 1 }
 };
 
diff --git a/lib/RT/Shredder/Plugin.pm b/lib/RT/Shredder/Plugin.pm
index c9a7978..8b20932 100644
--- a/lib/RT/Shredder/Plugin.pm
+++ b/lib/RT/Shredder/Plugin.pm
@@ -169,7 +169,7 @@ sub LoadByName
     my $self = shift;
     my $name = shift or return (0, "Name not specified");
 
-    local $@;
+    local $@ = undef;
     my $plugin = "RT::Shredder::Plugin::$name";
     eval "require $plugin" or return( 0, $@ );
     return( 0, "Plugin '$plugin' has no method new") unless $plugin->can('new');
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index e984efd..bab9f61 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -745,7 +745,7 @@ sub run_and_capture {
 
     close $child_in;
 
-    my $result = do { local $/; <$child_out> };
+    my $result = do { local $/ = undef; <$child_out> };
     close $child_out;
     waitpid $pid, 0;
     return ($?, $result);
@@ -946,7 +946,7 @@ sub lsign_gnupg_key {
     my %res;
     $res{'exit_code'} = $?;
     foreach ( qw(error logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1014,7 +1014,7 @@ sub trust_gnupg_key {
     my %res;
     $res{'exit_code'} = $?;
     foreach ( qw(error logger status) ) {
-        $res{$_} = do { local $/; readline $handle{$_} };
+        $res{$_} = do { local $/ = undef; readline $handle{$_} };
         delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
         close $handle{$_};
     }
@@ -1075,7 +1075,7 @@ sub start_apache_server {
 
     Test::More::diag(do {
         open( my $fh, '<', $tmp{'config'}{'RT'} ) or die $!;
-        local $/;
+        local $/ = undef;
         <$fh>
     });
 
@@ -1238,7 +1238,7 @@ sub file_content {
             warn "couldn't open file '$path': $!" unless $args{noexist};
             return ''
         };
-    my $content = do { local $/; <$fh> };
+    my $content = do { local $/ = undef; <$fh> };
     close $fh;
 
     unlink $path if $args{'unlink'};
@@ -1316,7 +1316,7 @@ END {
 
     # we are in END block and should protect our exit code
     # so calls below may call system or kill that clobbers $?
-    local $?;
+    local $? = undef;
 
     RT::Test->stop_server;
 
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 162fcaa..41db606 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -3195,7 +3195,7 @@ sub DESTROY {
     # DESTROY methods need to localize $@, or it may unset it.  This
     # causes $m->abort to not bubble all of the way up.  See perlbug
     # http://rt.perl.org/rt3/Ticket/Display.html?id=17650
-    local $@;
+    local $@ = undef;
 
     # The following line eliminates reentrancy.
     # It protects against the fact that perl doesn't deal gracefully
diff --git a/lib/RT/Tickets_Overlay_SQL.pm b/lib/RT/Tickets_Overlay_SQL.pm
index 94ce9c1..450cfe1 100755
--- a/lib/RT/Tickets_Overlay_SQL.pm
+++ b/lib/RT/Tickets_Overlay_SQL.pm
@@ -287,7 +287,7 @@ sub FromSQL {
 
     {
         # preserve first_row and show_rows across the CleanSlate
-        local ($self->{'first_row'}, $self->{'show_rows'});
+        local ($self->{'first_row'}, $self->{'show_rows'}) = (undef, undef);
         $self->CleanSlate;
     }
     $self->_InitSQL();
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index b201b59..a433ac3 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -128,7 +128,7 @@ sub extract_strings_from_code {
         print "Cannot open $file for reading ($!), skipping.\n";
         return;
     }
-    local $/;
+    local $/ = undef;
     $_ = <$fh>;
     close $fh;
 
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index a95af97..08a33a9 100755
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -179,7 +179,7 @@ sub parse_args {
 }
 
 sub usage {
-    local $@;
+    local $@ = undef;
     eval "require Pod::PlainText;";
     if ( $@ ) {
         print "see `perldoc $0`\n";
diff --git a/share/html/Admin/Elements/EditCustomFieldValuesSource b/share/html/Admin/Elements/EditCustomFieldValuesSource
index 9455c74..b9dcf70 100644
--- a/share/html/Admin/Elements/EditCustomFieldValuesSource
+++ b/share/html/Admin/Elements/EditCustomFieldValuesSource
@@ -60,7 +60,7 @@ my @sources;
 foreach my $class( 'RT::CustomFieldValues', RT->Config->Get('CustomFieldValuesSources') ) {
     next unless $class;
 
-    local $@;
+    local $@ = undef;
     eval "require $class";
     if( $@ ) {
         $RT::Logger->crit("Couldn't load class '$class': $@");
diff --git a/share/html/Install/index.html b/share/html/Install/index.html
index 922ea27..1cad40f 100644
--- a/share/html/Install/index.html
+++ b/share/html/Install/index.html
@@ -127,7 +127,7 @@ elsif ( $Run ) {
     $session{'CurrentUser'} = RT::CurrentUser->new;
     $session{'CurrentUser'}->LanguageHandle( $Lang );
 }
-my $lang_handle = do { local $@;
+my $lang_handle = do { local $@ = undef;
     eval {
         ($session{'CurrentUser'} || RT::CurrentUser->new($RT::SystemUser->Id))
             ->LanguageHandle

-----------------------------------------------------------------------


More information about the Rt-commit mailing list