diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-11-23 17:16:34 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-11-23 17:16:34 +0000 |
commit | 85324b4d0dbc2aa57740cf155e05f167f729f570 (patch) | |
tree | d1b54c05b417ad292ef40e3a489f049760a035b7 /sv.c | |
parent | a9fe210d2c78e54078c497ec463a09bde9076605 (diff) | |
download | perl-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.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) { |