CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Non-blocking read from a pipe

 



xsustek
New User

Dec 2, 2010, 6:43 PM

Post #1 of 2 (588 views)
Non-blocking read from a pipe Can't Post

Hi,

is it possible to do a non-blocking read from a pipe in perl?
Something like this.

Code
open(P, "myApp |") || die "Can't create pipe: $!"; 
while (1) {
if (isSomethingReadyToReadOnPipe(P)) {
$line = <P>;
# do stuff with output line of pipe
} else {
# do something else
}
}



rovf
Veteran

Dec 6, 2010, 6:09 AM

Post #2 of 2 (548 views)
Re: [xsustek] Non-blocking read from a pipe [In reply to] Can't Post

Never tried it by myself, but maybe the 4-argument form of the select function can do the trick.

Ronald

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives