in reply to loading modules using 'use'
There is not a universal compile-time in perl. If you execute an eval($somestring) for example, the code inside the eval has a compile-time long after the main program executes.
use Module is equivalent to the sequence BEGIN { require Module; Module->import( LIST ); }, you probably have already read about this. The BEGIN is the statement that moves any code into "compile-time" to be executed as soon as possible). When you 'use A', your "require Exporter" is already inside a BEGIN and therefore executed at compile-time of your main module. And because the import is after the require (so there is a strict order) in the same BEGIN, the import comes after the require
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: loading modules using 'use'
by angshuman (Novice) on Jun 30, 2010 at 12:21 UTC | |
by jethro (Monsignor) on Jun 30, 2010 at 12:45 UTC | |
by Taulmarill (Deacon) on Jun 30, 2010 at 13:07 UTC | |
by angshuman (Novice) on Jun 30, 2010 at 13:29 UTC | |
by wfsp (Abbot) on Jun 30, 2010 at 13:55 UTC | |
by ambrus (Abbot) on Jul 13, 2010 at 17:04 UTC |