Hi,
Is there a reason why you inherit AppMod to MyAppMod and create an object of AppMod at the same time ? If its just for overriding the subroutines, its not required. Consider the following.
This will result in{ package Animal; sub speak { my $class = shift; print "a $class goes ", $class->sound, "!\n" } } # Animal package from before { package Mouse; @ISA = qw(Animal); sub sound { "squeak" } sub speak { my $class = shift; print "a $class goes ", $class->sound, "!\n"; print "[but you can barely hear it!]\n"; } } Mouse->speak;
Here, Mouse has its own speaking routine, so Mouse->speak doesn't immediately invoke Animal->speak For more details of overriding, have a look at Overriding Methods on CPAN.a Mouse goes squeak! [but you can barely hear it!]
Cheers !
--VC
Note: Above example is from perlboot
In reply to Re: overridden and inheritance
by atemon
in thread overridden and inheritance
by wst
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |