Home » Perl » Are you receiving the “Useless localization of scalar assignment” error when using Exception::Class::TCF with Perl 5.10? I have a fix for you!

Are you receiving the “Useless localization of scalar assignment” error when using Exception::Class::TCF with Perl 5.10? I have a fix for you!

The following is a patch for bug 45563 in Exception::Class::TCF:

Useless localization of scalar assignment at Exception-Class-TCF/lib/Exception/Class/TCF.pm line 255.

Index: lib/Exception/Class/TCF.pm

--- lib/Exception/Class/TCF.pm	(revision 83)
+++ lib/Exception/Class/TCF.pm	(working copy)
@@ -251,8 +251,11 @@
my($block,@catches) = @_;
my($exc,@args,$res);
&$pushFrame;
-    $HANDLE_WARN &&
-      local ( $SIG{'__WARN__'} =  sub { throw Exception::Class::TCF::Warning @_;  } );
+
+    if ($HANDLE_WARN) {
+      local ( $SIG{'__WARN__'} ) =  sub { throw Exception::Class::TCF::Warning @_;  };
+    }
+
$dTHROWING = 0;
$res = eval { &$block() };
$exc = $EXCEPTION;
Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Facebook login by WP-FB-AutoConnect