in reply to Re: Re: Re: Sending STDOUT to Multiple Sockets
in thread Sending STDOUT to Multiple Sockets

If this is a wrapped C API the odds are good that it is just getting a file descripter and issuing a print at a level that is too low for the tie mechanism to intercept.

If that is the case, then your best solution is to have two processes, one of which is reading from the other, the other of which writes to all of the sockets. You can do this in various ways with fork, etc. (The Cookbook has this exact problem as an example.)

UPDATE
Alternate solution. Create a temporary file (for instance with File::Temp) and then let the code write to that, seek back to the beginning of the file, read it and write to the sockets, seek back and truncate. Not as immediate, but it solves the problem without creating a new process.

  • Comment on Re (tilly) 4: Sending STDOUT to Multiple Sockets