This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/op/sub.t: Suppress warnings properly
authorFather Chrysostomos <sprout@cpan.org>
Wed, 20 Nov 2013 14:03:09 +0000 (06:03 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 20 Nov 2013 16:28:39 +0000 (08:28 -0800)
We enable lexical warnings further up in the file, so $^W won’t do
anything to suppress the warnings from the glob assignment, only
those from XSLoader.

t/op/sub.t

index 06b8d07..a086063 100644 (file)
@@ -187,15 +187,16 @@ is *_{ARRAY}, undef, 'goto &xsub when @_ does not exist';
 # another XSUB if this fails.
 ok !exists $INC{"re.pm"}, 're.pm not loaded yet';
 {
-    local $^W; # Suppress redef warnings
     sub re::regmust{}
     bless \&re::regmust;
     DESTROY {
+        no warnings 'redefine', 'prototype';
         my $str1 = "$_[0]";
         *re::regmust = sub{}; # GvSV had no refcount, so this freed it
         my $str2 = "$_[0]";   # used to be UNKNOWN(0x7fdda29310e0)
         @str = ($str1, $str2);
     }
+    local $^W; # Suppress redef warnings in XSLoader
     require re;
     is $str[1], $str[0],
       'XSUB clobbering sub whose DESTROY assigns to the glob';