From: Nicholas Clark Date: Thu, 23 Nov 2006 17:16:34 +0000 (+0000) Subject: Assigning to a PVCV effectively just sets the prototype, so make this X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=85324b4d0dbc2aa57740cf155e05f167f729f570;p=p5sagit%2Fp5-mst-13.2.git Assigning to a PVCV effectively just sets the prototype, so make this the exact behaviour. (Fixes bug #40681, which prevents mod_perl from building) p4raw-id: //depot/perl@29364 --- diff --git a/sv.c b/sv.c index bcfbe8f..b29d2ec 100644 --- a/sv.c +++ b/sv.c @@ -3480,7 +3480,19 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) 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) {