in reply to Inheritance without defining the object on inherited module

The quick and dirty answer is that in Employee.pm, $object is not defined. Which is because in main.pl you call new Person ... instead of new Employee.

But there are no methods in Employee.pm: all of that codes runs at use time, called from main.pl.

For purposes of demonstration, you probably want to wrap the print in Employee.pm as a printme method, and call it from main, such as $object->printme().

Update:

Don't forget to change $object to the $self idiom.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: Inheritance without defining the object on inherited module
by thanos1983 (Parson) on May 18, 2015 at 09:14 UTC

    Hello QM

    I read again and again your answer but it is not so clear to me. Is it possible to provide a short sample code of the solution that you propose.

    Thanks in advance.

    Seeking for Perl wisdom...on the process of learning...not there...yet!