Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Exiting from capturing output in a while?

by BlaisePascal (Monk)
on Aug 08, 2000 at 05:06 UTC ( [id://26716]=note: print w/replies, xml ) Need Help??


in reply to Exiting from capturing output in a while?

I can't see anything obviously wrong with his code (except not checking the result of opening the log file and the last close is incorrect), but here's his code so others can look at it:
#!perl $program = "c:\\progdir\\bin\\proggie.exe"; $dstfile = "d:\\scripts\\log\\archive\\proggie.log"; $arg0 = "\"Blah.Blech.>\""; $timeout = 60; $starttime = time; open( PRG, "$program $arg0 |") || die "Couldn't open PRG: $!\n"; open (LF, ">$finaldest"); while (<PRG>) { print LF "$_"; $difftime = time - $starttime; last if ($difftime > $timeout); } close (LF); close (RVRD);
Tip to the anonymous monk: If you include your code in <CODE> tags, it will get formatted correctly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://26716]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-03-28 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found