Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Non-blocking pipe write

by Marcello (Hermit)
on Nov 04, 2004 at 18:58 UTC ( #405266=note: print w/replies, xml ) Need Help??

in reply to Re: Non-blocking pipe write
in thread Non-blocking pipe write

I tried:
#!/usr/local/bin/perl use strict; use warnings; use IO::Handle; use IO::Select; my $handle; my $pid; if (!defined($pid = open($handle, "|-"))) { die "Fork failed: ".$!; } elsif ($pid == 0) { # Child sleep(5); exit 0; } else { # Parent $handle->autoflush(1); my $selector = IO::Select->new($handle); my $i = 0; do { if ($selector->can_write(0)) { print $handle "ABC\n"; print "PIPE write ".++$i."\n"; } else { print "PIPE cannot write\n"; } } while (1); }
but only one pipe write is successful and then the can_write check fails every time. Can you be more specific please?

FYI, I am on Linux

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2020-06-07 10:10 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (42 votes). Check out past polls.