In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/6b776407d46448d59a69054c8cd4cec4d91f50c0?hp=b1b8fb6a79343831521b5657b353f551f7a35074>

- Log -----------------------------------------------------------------
commit 6b776407d46448d59a69054c8cd4cec4d91f50c0
Author: Dan Collins <[email protected]>
Date:   Tue Oct 11 14:54:16 2016 -0400

    overload.pm: add a missing 'exists'
    
    607ee4356 changed the hash of permitted ops from having '1' as a value
    to having undef as a value. This also changed one of the warning points
    from checking for truthiness to existence. However, a second warning
    was accidentally left checking for truthiness. This commit fixes that
    oversight, and adds a regression test for warnings in this case.
-----------------------------------------------------------------------

Summary of changes:
 lib/overload.pm           |  4 ++--
 t/lib/overload_fallback.t | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/overload.pm b/lib/overload.pm
index 758b67d666..ba563143f1 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -1,6 +1,6 @@
 package overload;
 
-our $VERSION = '1.27';
+our $VERSION = '1.28';
 
 %ops = (
     with_assign         => "+ - * / % ** << >> x .",
@@ -63,7 +63,7 @@ sub unimport {
   *{$package . "::(("} = \&nil;
   for (@_) {
       warnings::warnif("overload arg '$_' is invalid")
-        unless $ops_seen{$_};
+        unless exists $ops_seen{$_};
       delete $ {$package . "::"}{$_ eq 'fallback' ? '()' : "(" .$_};
   }
 }
diff --git a/t/lib/overload_fallback.t b/t/lib/overload_fallback.t
index a72d49912d..66722510de 100644
--- a/t/lib/overload_fallback.t
+++ b/t/lib/overload_fallback.t
@@ -5,7 +5,7 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
-    plan( tests => 3 );
+    plan(tests => 4);
 }
 
 use overload '""' => sub { 'stringvalue' }, fallback => 1;
@@ -33,3 +33,16 @@ my $value = bless \(my $dummy = 1), __PACKAGE__;
 print ++$value;
 EOC
 }
+
+{
+    my $warned = 0;
+    local $SIG{__WARN__} = sub { $warned++; };
+
+    eval q{
+        use overload '${}', 'fallback';
+        no overload '${}', 'fallback';
+    };
+
+    ok($warned == 0, 'no overload should not warn');
+}
+

--
Perl5 Master Repository

Reply via email to