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

You shouldn't have any problem unless one of the modules requires one of the others at compile-time. e.g. If one of the module imports from one of the others in the cycle, you might have problems.

But to use the module A's execute method, I will have to "use" it in module C

Not true. Class A must have already been loaded if an object of class A was previously created.

  • Comment on Re: Accessing a module's method without causing circular dependency

Replies are listed 'Best First'.
Re^2: Accessing a module's method without causing circular dependency
by rovingeyes (Sexton) on Apr 27, 2010 at 20:37 UTC
    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.
      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.

      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."