Why does Perl allow mutual "use" relationships between modules?
Posted
by Haiyuan Zhang
on Stack Overflow
See other posts from Stack Overflow
or by Haiyuan Zhang
Published on 2010-06-18T09:03:49Z
Indexed on
2010/06/18
9:33 UTC
Read the original article
Hit count: 186
perl
Let's say there are two modules that mutually use each other:
package a;
use b;
sub p {}
1;
package b;
use a;
1;
I think that it is systematically wrong to write code like the above, because the two modules will endlessly copy each other's code to themselves, but I can successfully run the following code, which makes me very surprised. Could any of you explain all of this to me?
#! /usr/bin/perl
use a;
a->p();
© Stack Overflow or respective owner