diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-09-14 13:13:30 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-14 22:29:47 -0700 |
commit | 3c104e59d83f6195ebcc80776f15604d74d666b2 (patch) | |
tree | f1a5edcc23b2b697687d2baf4eccb73d01e2cc08 /gv.c | |
parent | 697efb9be70535836d8ebd1327ecb1c72666000e (diff) | |
download | perl-3c104e59d83f6195ebcc80776f15604d74d666b2.tar.gz |
Make SUPER:: in main less sensitive
$ perl -e '$main::SUPER::; sub bar::bar{} @ISA = bar; main->SUPER::bar'
$ perl -e '$SUPER::; sub bar::bar{} @ISA = bar; main->SUPER::bar'
Can't locate object method "bar" via package "main" at -e line 1.
(That’s 5.10.1. More recent perls say package "SUPER".)
The only differnce that $SUPER:: variable makes is the name of
the SUPER:: package. It ends up being called SUPER instead of
main::SUPER.
This causes problems because gv_fetchmeth_pvn, seeing a package end-
ing in ::SUPER, strips off the ::SUPER before doing isa lookup.
But SUPER does not end in ::SUPER, so this commit adjusts
gv_fetchmeth_pvn to account.
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -692,10 +692,12 @@ Perl_gv_fetchmeth_pvn(pTHX_ HV *stash, const char *name, STRLEN len, I32 level, } packlen = HvNAMELEN_get(stash); - if (packlen >= 7 && strEQ(hvname + packlen - 7, "::SUPER")) { + if ((packlen >= 7 && strEQ(hvname + packlen - 7, "::SUPER")) + || (packlen == 5 && strEQ(hvname, "SUPER"))) { HV* basestash; - packlen -= 7; - basestash = gv_stashpvn(hvname, packlen, + basestash = packlen == 5 + ? PL_defstash + : gv_stashpvn(hvname, packlen - 7, GV_ADD | (HvNAMEUTF8(stash) ? SVf_UTF8 : 0)); linear_av = mro_get_linear_isa(basestash); } |