in reply to Re^4: Inheritance without defining the object on inherited module
in thread Inheritance without defining the object on inherited module
You cannot (or rather, should not) use code as both, a function and a method. Using inheritance is the bad approach in any way.
If you want to call the subroutine in Person from Employee, just call it directly:
package Person; my %WARN; sub get_warnings { return \%WARN; };
package Employee; use Data::Dumper; sub frobnicate { my $warnings_by_person = Person::get_warnings; warn Dumper $warnings_by_person; };
|
|---|