summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-11-23 17:16:34 +0000
committerNicholas Clark <nick@ccl4.org>2006-11-23 17:16:34 +0000
commit85324b4d0dbc2aa57740cf155e05f167f729f570 (patch)
treed1b54c05b417ad292ef40e3a489f049760a035b7 /sv.c
parenta9fe210d2c78e54078c497ec463a09bde9076605 (diff)
downloadperl-85324b4d0dbc2aa57740cf155e05f167f729f570.tar.gz
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
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index bcfbe8fea2..b29d2ec8a2 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) {