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
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.