perl - How to filter a lot of data with IPC::Open2? -
My job is to filter some data with Perl scripts with external usability (ADR2 line). The size of the data is quite large. I need to print many data to the program Now I do it with My code: Yes, you will write your program in the barrier of buffer capability. Your input buffer ( The reading and writing mix will help, because you are about to empty the input buffer about the external program. It is the rate of filling it. Another thing that is using files for interprocess communication instead of pipes or sockets (as it does stdin and read a lot of data back (from the
stdout program in my script).
IPC :: Open2 , but I do not like to read and write. Is it legal?
open2 will buffer data of any size in the pipe?
My $ cmd = "addr2line -e $ prog_name"; Use IPC :: OpenOffice; Local (* Reader, * Writer); My $ pid = open2 (* * Reader, * author, $ CMD); (@requests) {# This array is large, more than 100 print author "$ _ \ n" of thousands of entries; } Close authors; (@requests) {$ function_name = & lt; Reader & gt; $ Filesource = & lt; Reader & gt; # ... store ..} close reader; Waitpid ($ PID, 0);
Reader ) will fill and block the execution of your external program.
IPC :: Open2 ) helps. Then you will only be limited to the amount of free disk space. You can do it yourself, though by default use the files for the IPC.
Use Forks :: Super 'Open2'; ... my ($ $ reader, $ author, $ pid) = open2 (@command); {$ $ Author $ $ _ \ n "} $ $ Author for $requests; (@requests) {... read ...} For $ $ Reader; Wait $ pid, 0;
Comments
Post a Comment