This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make newCONSTSUB use the right warning scope.
authorFather Chrysostomos <sprout@cpan.org>
Mon, 21 Nov 2011 08:06:23 +0000 (00:06 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 21 Nov 2011 08:32:32 +0000 (00:32 -0800)
newCONSTSUB uses the compile-time warning hints, instead of the run-
time hints.  This means that

  use warnings;
  BEGIN {
    no warnings;
    some_XS_function_that_calls_new_CONSTSUB();
  }

may trigger a redefinition warning, whereas it should be analogous to

  use warnings;
  BEGIN {
    no warnings;
    *foo = \&bar;
  }

which does not warn.

newCONSTSUB localises PL_curcop and sets it to &PL_compiling.  When it
does that, it needs to copy the hints over.

Running tests inside eval is not reliable without a test count, so I
added one.


No differences found