Hi all,
Requirement:
- I have a perl script that I need to run for several hours, for a performance test.
- I would like to create a second script in ANSI C to call the perl script. The C script should be able to parse any of the text output from the perl script at run time, one line at a time.
- This C code will be used by the performance tool, Loadrunner. The processed output will be used as real time performance statistics of a database.
- I do not want to have to rewrite/port the entire perl script over the C.
I can think of 2 ways to do this.
1) Somehow direct the perl script output back to the calling C program where it may be parse and processed one line at a time.
2) call the perl script and direct output to a text file and continually read the last line of the file to have it in real-time/run-time.
Problems:
1) popen() almost works to launch the perl script. However, the perl script has to finish executing before any of the output can be processed. I want to process the output in real-time.
2) If I were to instead try to read the output from a txt file in real-time, I'm not sure how I would do it.
I am familiar with scripting, but, I have never tried doing anything like this before and I am having a hard time finding anything like this while searching around the net.
Any ideas or direction to some examples would be greatly appreciated!
Thanks,
-Brian