- /* Redefining a sub - warning is mandatory if
- it was a const and its value changed. */
- if (CvCONST(cv) && CvCONST((const CV *)sref)
- && cv_const_sv(cv)
- == cv_const_sv((const CV *)sref)) {
- NOOP;
- /* They are 2 constant subroutines generated from
- the same constant. This probably means that
- they are really the "same" proxy subroutine
- instantiated in 2 places. Most likely this is
- when a constant is exported twice. Don't warn.
- */
- }
- else if (ckWARN(WARN_REDEFINE)
- || (CvCONST(cv)
- && (!CvCONST((const CV *)sref)
- || sv_cmp(cv_const_sv(cv),
- cv_const_sv((const CV *)
- sref))))) {
- Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
- (const char *)
- (CvCONST(cv)
- ? "Constant subroutine %s::%s redefined"
- : "Subroutine %s::%s redefined"),
- HvNAME_get(GvSTASH((const GV *)dstr)),
- GvENAME(MUTABLE_GV(dstr)));
- }
+ SV * const new_const_sv =
+ CvCONST((const CV *)sref)
+ ? cv_const_sv((const CV *)sref)
+ : NULL;
+ report_redefined_cv(
+ sv_2mortal(Perl_newSVpvf(aTHX_
+ "%"HEKf"::%"HEKf,
+ HEKfARG(
+ HvNAME_HEK(GvSTASH((const GV *)dstr))
+ ),
+ HEKfARG(GvENAME_HEK(MUTABLE_GV(dstr)))
+ )),
+ cv,
+ CvCONST((const CV *)sref) ? &new_const_sv : NULL
+ );