This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make get_cv cope with subrefs
authorFather Chrysostomos <sprout@cpan.org>
Tue, 31 Oct 2017 17:16:59 +0000 (10:16 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 31 Oct 2017 21:54:52 +0000 (14:54 -0700)
commita385812b685b3164e706880a72ee60c9cc9573e4
tree8ed66eb53fd747056dc8a47d5bcdd396891dea21
parent7cfe4f5255a555764f03a74312f9b7736c4142ec
Make get_cv cope with subrefs

When called with GV_NOADD_NOINIT, get_cv will fail an assertion if the
thingy in the stash is not a GV.

While calling with GV_NOADD_NOINIT is a strange thing to do, neverthe-
less Cpanel::JSON::XS does it with "Encode::decode", which is not an
unreasonable thing to do if it is known that the sub already exists.

This commit makes get_cv take sub refs into account, so that, when we
re├źnable the optimisation reverted by 9bceb75b8d9, Cpanel::JSON::XS
will continue to work with bleadperl.

(Currently, the optimisation only applies to the main package, which
is why I am able to test this now.)
ext/XS-APItest/APItest.xs
ext/XS-APItest/Makefile.PL
ext/XS-APItest/t/get.t
perl.c