in reply to How to delete a method in a subclass?
What do you want to happen if someone calls such a method?
Anyway, yeah -- override the method in the subclass. Have it throw an exception, or do nothing. If you have lots of methods like that (then you should rethink your design, but) you can do something like
sub meth1 { obsoleted } sub meth2 { obsoleted } sub meth3 {} # do nothing, quietly. # [...] sub obsoleted { require Carp; Carp::croak "obsoleted method called"; # exception, with stack tra +ce # or, just complain but go on with the show. Carp::cluck "obsoleted method called"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to delete a method in a subclass?
by ihb (Deacon) on Dec 21, 2004 at 10:49 UTC | |
by gaal (Parson) on Dec 21, 2004 at 12:10 UTC |
In Section
Seekers of Perl Wisdom