It's called a "race condition". I've seen it, but I try really hard to avoid it. Not always easy to do.

X uses Y, Y uses X. So let's go down the compiler's path for this. During the compilation of X, we see this statement "use Y;". So, we stop compiling X, load Y, and compile it. During that, we see the statement to "use X;". We stop and ... no, we see that X is already loaded. So we call X->import(), and continue. We finish compiling Y, including executing any of its global statements, and then go back to X and continue.

The solutions include:


In reply to Re: Sharing variables and subroutines between modules: unexpected warnings and errors. by Tanktalus
in thread Sharing variables and subroutines between modules: unexpected warnings and errors. by dimar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.