Suppose that what you are evaling has multiple package statements? What package does the overall thing have? Does the question even make sense?
Your regex doesn't handle this. Nor does it handle the case where the code has no package statement in it. (In which case you get your current package.)
Instead I would ask why you want to know what package the external code has, and solve that problem directly.
In reply to Re (tilly) 1: Getting the package of evaluated source code:
by tilly
in thread Getting the package of evaluated source code:
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |