good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Namespace after forking()+eval()ing providing unexpected resultsby JPaul (Hermit) |
on Jan 23, 2002 at 10:05 UTC ( [id://140840]=perlquestion: print w/replies, xml ) | Need Help?? |
JPaul has asked for the wisdom of the Perl Monks concerning the following question:
Greetings all, I'm having a bit of trouble with a piece of code of mine. It works kinda like this: I have two programmes, Launcher and Code. There are two modules, LaunchMod.pm and CodeMod.pm. Straightforward, right? Good. So: Launcher loads Code from a text file, and passes it in a single string variable to LaunchMod.pm, which then does a little: Inside Code is: And inside CodeMod::MySub is a line or two that, very simply (for testing purposes) prints out the contents of $main::me. Only problem is - it doesn't. The above says that $main::me is undefined. If I don't use LaunchMod.pm to fork/eval, and instead put that same fork/eval code inside Launch itself, everything is hunky-dory. Obviously I'm setting up the namespace wrong, but I'm just not understanding where... Whether it forks inside the main code (Launch) or off in its module, I don't see how that can affect the eval()ed code like this... Help?
JP,
Back to
Seekers of Perl Wisdom
|
|