my $x = SubClass->new; # inherits from SuperClass
$x->method; # calls SubClass::method
{
local @FAKE::ISA = @{ ref($x) . "::ISA" };
$x->FAKE::method; # calls SuperClass::method
}
$x->method; # calls SubClass::method
####
my $x = SubClass->new; # inherits from SuperClass
$x->method; # calls SubClass::method
{
# save the glob...
local *old = *{ ref($x) . "::method" };
# localize the glob...
local *{ ref($x) . "::method" };
# and restore everything else
${ ref($x) . "::method" } = $old;
@{ ref($x) . "::method" } = @old;
%{ ref($x) . "::method" } = %old;
# technically incomplete
$x->method; # calls SuperClass::method
}
$x->method; # calls SubClass::method
####
my $x = SubClass->new; # inherits from SuperClass
$x->method; # calls SubClass::method
{
my $pkg = ref $x;
eval qq{
package $pkg;
\$x->SUPER::method; # calls SuperClass::method
};
}
$x->method; # calls SubClass::method
####
local &foo;