This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make SUPER::method calls work in moved stashes
authorFather Chrysostomos <sprout@cpan.org>
Fri, 14 Sep 2012 20:35:53 +0000 (13:35 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 15 Sep 2012 05:29:47 +0000 (22:29 -0700)
commit0308a534a635b8c34297657046d32a3f05818821
tree370a0f550c2b30c8c5efda2f966cd83cb8c54a23
parent3c104e59d83f6195ebcc80776f15604d74d666b2
Make SUPER::method calls work in moved stashes

BEGIN {
  *foo:: = *bar::;
  *bar:: = *baz;
}
package foo;
@ISA = 'door';
sub door::dohtem { 'dohtem' }
warn bar->SUPER::dohtem;
__END__
Can't locate object method "dohtem" via package "bar::SUPER" at - line 8.

When gv_fetchmethod_pvn_flags looks up a package it changes SUPER to
__PACKAGE__ . "::SUPER" first.  Then gv_fetchmeth_pvn uses HvNAME on
the package and strips off the ::SUPER suffix if any, before doing
isa lookup.

The problem with using __PACKAGE__ (actually HvNAME) is that it might
not be possible to find the current stash under that name.  HvENAME
should be used instead.

The above example happens to work if @ISA is changed to ‘our @ISA’,
but that is because of an @ISA bug.
gv.c
t/op/method.t