This is a perl programming question which came up in some systemd discussion:
I have a daemon in perl which currently uses $socket = IO::Socket::INET->new(...) to create a TCP socket.
When such a daemon should be used with inetd or systemd socket activation, it should be able to use STDIN/STDOUT (or other passed filedescriptors) as a socket.
Is it possible to "transform" STDIN/STDOUT into a corresponding perl object? The intention is to replace only the above "new"-command by some code so that afterwards all of the rest of the daemon would work unchanged with inetd (so that e.g. $socket->accept(), $socket->recv(...), $socket->send(...) work afterwards with inetd by reading/writing appropriate data to STDIN/STDOUT).

