in reply to Re^2: Inheritance and module cross dependencies
in thread Inheritance and module cross dependencies

Plan:
  1. Create TeacherFactory.pm:

    package TeacherFactory; use Teacher; use strict; sub create_teacher { my ($class, @args) = @_; return Teacher->new(@args); } 1;
  2. Make a list of all files that call Teacher->new.
  3. Insert near their tops a use Teacher; statement.
  4. Search and replace teacher constructions with factory requests.

That's the easy part; you have a pretty boring factory. Now make it interesting :)

Most likely, you may find that some calls to Teacher->new give you insufficient information to make the decision about whether a Lecturer or a teacher is required. Refactor your code *after* you have the above in place to either defer or advance the construction, depending on what makes more sense. But move in small steps that don't leave your code unstable.