in reply to Re^4: parsing the results of the subroutine in real time
in thread parsing the results of the subroutine in real time
You can use two separate programs. With those, you can use an anonymous pipe on the command line. You could also use a named pipe or a Unix socket. You could even use Berkeley sockets (the canonical implementation of a TCP/IP API).
You can use threads or fork a new process and use a producer/consumer model. You can then use a pipe, sockets, or shared memory. In the case of threads you also have other options.
You could have one program open another via a piped open call or use IPC::Open2 (or IPC::Open3, if needed).
An alternative is to process your input in chunks and to process your output in chunks, then put your subroutines in a loop. Here's one example of that: while ( <> ) { output( input( $_ ) ) } It really matters what type of data you're dealing with whether or not this would work.
|
|---|