I have two potentially basic questions about packages and scoping. I am self taught so I think that there may be a chance that there is something basic I'm not understanding here that can clear this up immediately. I have two different Perl modules, let's say package A and B.
Let's say that Package A uses Package B. However, as things become more complex, we find out that Package B needs to use some subroutines from Package A as well.
We know that we cannot just put use B; in Package A AND use A; in Package B because that would cause a circular reference. Also, we noticed that package B can call Package A subroutines directly without using use A;. While I can understand that there are package wide variables that can be accessed between the two packages, I don't understand how package B can call package A subroutines without using use A;
So the questions are:
1) What is the proper way to have package A and package B use each others subroutines without causing a circular reference?
2) Why is it that package B can use package A subroutines without using use A;
Let me know if more details are needed on my question - I hope that was clear.
In reply to Preventing Circular References in Modules by ramensaurus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |