in reply to GUI-like behavior
Perhaps you could put in a signal handler that would allow you to eval some new code in, and then continue, along the following (untested) lines:
my $code_file = '/tmp/myscript.cmds'; $SIG{HUP} = sub { unless ( -e $code_file ) { warn "Received HUP signal, but no command file."; return; } eval { require $code_file; unlink $code_file; }; if ( ! $@ ) { warn "Caught HUP signal and processed command file"; } else { warn "Caught HUP signal but unable to process commands: $@"; } };
While your script is running interactively, you can use another session to write commands to this file and HUP your running Perl process.
> echo "$foo = 27" >> /tmp/myscript.cmds > killall -HUP perl
A major caveat: signal handlers are notoriously finicky and idiosyncratic, so this approach might not be particularly reliable or portable.
|
|---|