From 85324b4d0dbc2aa57740cf155e05f167f729f570 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 23 Nov 2006 17:16:34 +0000 Subject: [PATCH] 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 --- sv.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) { -- 2.7.4