The typical solution would be to add fake entries to %INC, so require and therefore use thinks the module has already been loaded and doesn't need to be loaded again. If I put $INC{'Test/Module/Hello/Hello.pm'}=1; after the first eval and $INC{'Test/Module/Hello/Goodbye.pm'}=1; after the second, your code seems to run fine, even when I reenable the use lines. (If later parts of your program might depend on it, you might want to add a more useful value to %INC instead of 1.)

An alternative (but equivalent) solution is to put use me::inlined; in each of the packages you're evaling.


In reply to Re: use of already eval()ed module (from string) by haukex
in thread use of already eval()ed module (from string) by bliako

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.