What you want does not really exist, as far as I know.
The closest thing to what you want, at a general level, is XDebug . It turns the process into a small server that will receive debug commands. This is usually used for debugging and profiling, and not as interprocess communication, but it is an opportunity. I believe that ActiveState Perl can be run as an XDebug server.
Otherwise, you need to explicitly program some kind of side channel that your Perl program listens for commands (which XDebug does). It can be as simple as opening a socket that reads a string, talks about it, encodes the result as YAML (or something else) and writes it back. REPL, but on the connector, not on the terminal.
There are obviously security implications that will remain as an exercise for the reader. You also don’t want to listen to the socket to interrupt the program, so now you need something event driven or streaming.
Sorry, I have nothing more specific. This will make an excellent CPAN module.
Schwern
source share