in reply to Re: Accessing a module's method without causing circular dependency
in thread Accessing a module's method without causing circular dependency

Oh, so I guess I misunderstood how the use statement itself works. I have to read the manual for it again. So does that mean when you say "use <some module>", if it is already loaded, Perl does not load it again? If that is the case then I guess I don't have to worry here. Thanks.
  • Comment on Re^2: Accessing a module's method without causing circular dependency

Replies are listed 'Best First'.
Re^3: Accessing a module's method without causing circular dependency
by almut (Canon) on Apr 27, 2010 at 20:42 UTC
    So does that mean when you say "use <some module>", if it is already loaded, Perl does not load it again?

    Yes, Perl keeps track of loaded modules in %INC.

Re^3: Accessing a module's method without causing circular dependency
by ikegami (Patriarch) on Apr 27, 2010 at 20:49 UTC

    Correct. The module is neither compiled nor executed a second time, although it's import method is called every time use is used (unless prevented using () or qw()).

    use: "The require makes sure the module is loaded into memory if it hasn't been yet."