I'm looking for a simple way to pass messages from one process (Perl script, short-lived) to another (Python script, long-running) - both processes local to the same machine. I've done some research, but what I've found was either over my head or seemed unnecessarily complex - leaving me a bit lost and confused.
I imagine a minimal example roughly like the following:
# listener.py
class Listener:
def __init__(self, port)
self.port = port
def on_message(self, msg):
print "%s: %s" % (timestamp, msg)
recipient = Listener(1234)
# sender.pl
sub send_message {
my ($msg, $port) = @_;
# ...
}
send_message("hello world", 1234);
Any pointers on how to solve and/or where to read up on this would be greatly appreciated!
python somescript.py | perl otherscript.pl
should work nicely. No sockets. – S.LottListener
was a desktop widget displaying incoming messages (kinda liketail -f mylog
). – AnC