use warnings;
use utf8;
use open qw( :utf8 :std );
-use Test::More tests => 9;
+use Test::More tests => 11;
use XS::APItest;
is $w, undef, 'newCONSTSUB uses calling scope for redefinition warnings';
}
};
+
+{
+ no strict 'refs';
+ *{"foo::\x{100}"} = sub(){return 123};
+ my $w;
+ local $SIG{__WARN__} = sub { $w .= shift };
+ newCONSTSUB_type(\%foo::, "\x{100}", 0, 1);
+ like $w, qr/Subroutine \x{100} redefined at /,
+ 'newCONSTSUB redefinition warning + utf8';
+ undef $w;
+ newCONSTSUB_type(\%foo::, "\x{100}", 0, 1);
+ like $w, qr/Constant subroutine \x{100} redefined at /,
+ 'newCONSTSUB constant redefinition warning + utf8';
+}
CopLINE_set(PL_curcop, PL_parser->copline);
Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
CvCONST(cv)
- ? "Constant subroutine %s redefined"
- : "Subroutine %s redefined"
- ,name);
+ ? "Constant subroutine %"SVf
+ " redefined"
+ : "Subroutine %"SVf" redefined",
+ newSVpvn_flags(
+ name,len,(flags&SVf_UTF8)|SVs_TEMP
+ ));
CopLINE_set(PL_curcop, oldline);
}
nope: