Subject: | LexEnv changes current package |
I have an application that's a slightly customized Devel::REPL
underneath. Part of the convenience layer is adding a bunch of globals
to the main package. This is thwarted by the fact that the evaluated
code is run within "Lexical::Persistence" -- at least if that plugin was
loaded.
Now, it's easy to force the evaluated code into some package by adding a
"package main;" to the code generation in LexEnv.pm, but it should
ideally be possible to change the package on the command line. One way
to work around this would be to inject code that saves caller(0)[0] into
some fully specified global $some::where after evaluating the user code.
Then when the next line is evaluated, we add the "package $some::where;"
statement. Needless to say, that's a horrible kludge.
I don't know Lexical::Persistence or Devel::REPL enough to suggest a
better course of action. If somebody has any better suggestions, I'd be
willing to try to cough up an implementation.
Cheers,
Steffen