This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make sv_set[ps]v(cv...) set prototype
authorFather Chrysostomos <sprout@cpan.org>
Tue, 11 Oct 2011 12:54:57 +0000 (05:54 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 11 Oct 2011 13:05:31 +0000 (06:05 -0700)
commit74ee33f245d1492bced4e403263d24881ffdfaa5
tree097ca27dbd3a1a2e2ee39ac9c0ae66b27e1a5858
parent60dde6b20521a0b199e8c9b6867f2a51013ba31c
Make sv_set[ps]v(cv...) set prototype

The SvPVX slot of a CV is used both for the prototype and for the sub
name passed to an XS AUTOLOAD sub.

It used to be that such AUTOLOADing would clobber the prototype.

Commit 8fa6a4095 made the two uses of SvPVX try to play along nicely
with each other, so the prototype comes after the sub name if both
need to be present.  It added the CvPROTO macro to account for that.

Some CPAN modules expect to be able to set the prototype with
sv_set[ps]v.  So this commit makes that work as expected, by turn-
ing off the flag that says the prototype comes after the auto-
loaded sub name.

Anyone using Scalar::Util::set_prototype to work around the proto-
type-clobbering bug can now continue to do so, without triggering
a new bug.
ext/XS-APItest/APItest.xs
ext/XS-APItest/t/svsetsv.t
sv.c