in reply to (Ovid - Dang, I love this place -- and one more question :)
in thread Typeglobs and Symbol tables
First I figured you could undef a subroutine:
But then I realized that the subroutine wasn't defined in MyCGI, it was defined in CGI. So I don't think you can undef an inherited routine. But I'm not sure...package MyCGI; use base CGI; undef(*MyCGI::param);
Update: would it be possible to (instead of using @ISA for inheritance) copy all of the subroutine refs from the parent class symbol table into your own and then delete one of them? I'll look into it...
Later: yes, you can copy from a superclass instead of using @ISA:
package A; sub abc { "abc\n" }; sub def { "def\n" }; package B; # inherit from A all but A::def foreach my $symname (keys %A::) { next if $symname eq 'def'; $B::{$symname} = $A::{$symname}; } my $b = bless({}, 'B'); print $b->abc; # prints "abc\n" print $b->def; # no such method
|
|---|