in reply to Re^2: Class Inheritance without an instance
in thread Class Inheritance without an instance / $AUTOLOAD equ
If you want Perl to act in an OO way, you should make a method call, not a sub call. Use B->foo, and A::foo will be called.
If you can't or won't, you're out of luck.
use strict; use warnings; $| = 1; sub A::foo {print "This is A::foo\n"} @B::ISA = qw /A/; print "Calling B->foo(): "; B->foo(); print "Calling B::foo(): "; B::foo(); __END__ Calling B->foo(): This is A::foo Calling B::foo(): Undefined subroutine &B::foo called at ...
|
|---|