in reply to Re: Why is 'require' not working as I expect?
in thread Why is 'require' not working as I expect?

It is still not working when I put the code into a module.

I get the same error: undefined subroutine.

So to clarify, now I have module A which uses module B. Both modules use module C which exports many functions by default. When module A tries to call one of these functions, I get the error.

Thanks for the help.

  • Comment on Re^2: Why is 'require' not working as I expect?

Replies are listed 'Best First'.
Re^3: Why is 'require' not working as I expect?
by Corion (Patriarch) on Oct 25, 2005 at 20:45 UTC

    Did you read the documentation on require? Did you read xdgs excellent explanation which he posted to further clarify my reply? Did you read the other reply? What part did you not understand about the explanations given?

      What part did you not understand about the explanations given?

      I understood and implemented them. But I think I tracked down the real problem. Forget what I said about Module A, B and C for a second. Let me explain it anew:

      1. Module A defines some functions that Module B calls. Module A exports these functions into Module B's namespace.

      2. Module B only has one function and it is called by Module A in one of its functions. So I made Modules A use Module B.

      3. When I use warnings with both Module A and B, I get 'subroutine redefined' warnings...

      Do you see my error yet? I think I do. But I am unsure how to solve it. Both modules are interdependant on each other.

        I am going to put this is a new question with more details... so hold off on your answer just yet please.