Don't ask to ask, just ask | |
PerlMonks |
"individually" override a super class's object methodsby TOD (Friar) |
on Nov 13, 2007 at 06:03 UTC ( [id://650441]=perlquestion: print w/replies, xml ) | Need Help?? |
TOD has asked for the wisdom of the Perl Monks concerning the following question:
hi all, my question is quite simple: is it possible to individually override a method an object has inherited from its mother class? so far for the mother class, here's the child: the script for testing: as you can see, my intention is to make some certain instances always return the false value in a call to $obj->modified. the thing is that $self->modified = sub { 0 }; produces the error: "Can't modify non-lvalue subroutine call at MyChild.pm line 12", whereas $self::modified = sub { 0 } has no effect. maybe that question has been put here already sometime, i couldn't find it by a search query. however, if you happen to find an appropriate node, please let me know. (even if it's the link to a manpage. ;-)) many thx in advance TOD
-------------------------------- masses are the opiate for religion.
Back to
Seekers of Perl Wisdom
|
|