why does perl allow mutually "use" relationship 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:13 UTC
Read the original article Hit count: 207

Filed under:

let's say there two modules mutualy use each othe as:

package a;
use b;
sub p {}

1;

package b;
use a;
1;

I think symatically it's wrong to wrote code like the above code, cus 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. so could any of you explain all of this to me?

#! /usr/bin/perl
use a;
a->p();

© Stack Overflow or respective owner

Related posts about perl