in reply to Modules inheritance

As a general thing I wouldn't bother answering a question that is a blob of text with no formatting, so count yourself lucky! If you can't be bothered to make your question readable why should I bother to answer it?

Modules don't "inherit" from other modules, they use other modules. Inheritance is an object oriented related thing. Modules often however provide class implementations which do inherit from other classes.

For module/package details see perlmod.

Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^2: Modules inheritance
by Arsenii Gorkin (Novice) on May 26, 2016 at 21:38 UTC

    Sorry for formatting. This is my first post here and I am not accustomed for an old-fashion formatting with <> tags)) But I promise - I will learn it and further will be better with my questions. Again - sorry.

    Regarding the question - of course - classes. I need to call methods from one module in the other one (in the kind of similar sequence I asked in the question). And I do not really know how to get it. I have a lot of errors in the code due to using "Use A::n" and "use A" etc and so on in modules that use (as a result) each other across the code. I do not know - is it a bad practice or what I do wrong?

    Say: I have A that calls A::1 and A::2 and A::2 calls A as well and A::3, and A::3 calls all of those. What to better do here you think?

    Thanks!

    And again - sorry for formating.

      That sort of "circular reference" is a fairly common issue. Often breaking circularity involves pulling out some common code B that is used by both A and A::2.

      You may get better answers if you can show us a small sample of your code showing the issues.

      Probably it's a typo, but "Use A::n" is not valid Perl - Perl is case sensitive; use is lower case.

      Premature optimization is the root of all job security
        Yes. It was just an example. (regarding Use A::n). Sorry for my rush))

        To be honest: I would be so glad to share all my code but it is toooo long (15 modules now and a lot of files calling them). I use always some tricks to go over that issues but now I am done to do that and want to find a really charm idea how to beat that issues)).

        I am really happy you caught the idea of circularity between packages. This is the very problem.

        Sometimes it says: cannot locate method "new" via package "blabla::1" or so... It hurts me so much))