in reply to making a subroutine export into the main script and also to other modules
use has two parts. The first, the require part, loads the named module, unless perl has already loaded it. The second part calls the module's import() method, which usually exports symbols into the calling package's namespace. That second part always happens, even if perl has already loaded the call and regardless of how many other modules have called that import().
I recommend using use Module; in all code that needs to use Module's code. It's nicely self-documenting that way, plus if you ever use that module from outside of your program (and without other code that actually uses the Module on which your code relies), you don't have to worry about mysterious failures when it's not there.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: making a subroutine export into the main script and also to other modules
by leocharre (Priest) on Mar 20, 2006 at 15:25 UTC |