the exact behaviour. (Fixes bug #40681, which prevents mod_perl from
building)
p4raw-id: //depot/perl@29364
dtype = SvTYPE(dstr);
sflags = SvFLAGS(sstr);
- if (sflags & SVf_ROK) {
+ if (dtype == SVt_PVCV) {
+ /* Assigning to a subroutine sets the prototype. */
+ if (SvOK(sstr)) {
+ STRLEN len;
+ const char *const ptr = SvPV_const(sstr, len);
+
+ SvGROW(dstr, len + 1);
+ Copy(ptr, SvPVX(dstr), len + 1, char);
+ SvCUR_set(dstr, len);
+ } else {
+ SvOK_off(dstr);
+ }
+ } else if (sflags & SVf_ROK) {
if (dtype == SVt_PVGV && SvTYPE(SvRV(sstr)) == SVt_PVGV) {
sstr = SvRV(sstr);
if (sstr == dstr) {