in reply to use of already eval()ed module (from string)

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.

Replies are listed 'Best First'.
Re^2: use of already eval()ed module (from string)
by bliako (Abbot) on Jan 08, 2019 at 21:42 UTC

    yes, thanks for this simple tip (i.e. modifying the %INC). It solved the problem.

      Note that module_notional_filename from Module::Runtime, when given a module name like "Foo::Bar", will tell you what the %INC key should be ("Foo/Bar.pm").

      I also like LanX's idea of an @INC hook, that's a bit more powerful.