By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,708 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,708 IT Pros & Developers. It's quick & easy.

pipe output to a perl script

P: 3
Hello,

I currently have an application in perl that starts a text based torrent client, once I give the necessary parameters to the torrent.exe it will start printing out the following information and of course downloading the files.

saving: Images (12680.2 MB)
percent done: 4.8
time left: checking existing data download
to: q:\Image
download rate:
upload rate:
share rating:
seed status:
peer status:
I have no problem starting the process and piping its output to a log file to read it (currently what I do). However the file is getting very big to loop around it. I do have to say I have idea how to read just the last part of the file and since I cant kill the torrent.exe the output just gets appended to the bottom of the log file and can not modify the log file since it is still open by the exe.

I want to create a perl (or maybe use something else) to pipe the output of the exe so that I can query the last values. Say for example my file is call run_torrent.pl, I want to send a command to this file like "run_torrent.pl --percent" and get back the value that was last printed by torrent.exe (the exe does not have these option)

My current limitation is that Im running this from Windows and I can not execute the torrent.exe program again, because it will kill the last download I started.

I am not sure what I am looking for, or how to make my query of the process simpler. I know its a bit confusing but I could really use some help. Some one suggested using StreamReader, but I dont get how I would start the program from the streamreader and how to query it. Running Active perl 5

Thanks for any suggestion,
Afelotreyu
Sep 16 '08 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
Look into IPC::Open2 or IPC::Open3 both come with perl
Sep 17 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.