Michael Kraus wrote:
G'day...
'Ello :)
If a sublass has overrides a method in a superclass, and the subclasses method calls the superclass's method, is there any mechanism to detect that the superclass' method has been overridden?
I'm wanting to write a method in an abstract class that must be overriden by it's children. If it is called directly (i.e. without being overriden) then it registers an error, but if its called via an overriding method then do some common functionality.
I'm guessing there is no in-built functionality for this, and I'll have to examine my classes to discover how to test for it myself. Is it possible to confirm this?
Since you are writing these methods (and hence controlling the paradigm) I'd add variables to your object when you over ride it like
$obj->{got_override} = 'package::version';
then in your main 'overridden' one:
die "I absolutley must be overridden" if !$obj->{got_override};
That way you can control the overridden status wherever it needs it and maybe even track how it was overridden with the package/verison thing
HTH :)
Lee.M - JupiterHost.Net
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>