Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Untitled question

by ahunter (Monk)
on Jul 05, 2000 at 21:45 UTC ( [id://21170]=note: print w/replies, xml ) Need Help??


in reply to More IPC::Open2 stuff

Hmm, the buffering problems outlined in my select tutorial (here) also apply to open2, and indeed any other type of file that can block. If you're reading from multiple files, you can use the Multiplex package presented there (and you can use it to implement timeouts, too). Use sysread and syswrite to write to the filehandles returned by open2 (if you're only reading from one filehandle, you don't really need the complexities of using select, and $SIG{ALRM} will let you interrupt something that's blocking)

Setting the filehandle to nonblocking is probably not the answer to this, but it may help with the buffering problem. If you do set the nonblocking flag, use select to avoid having to poll the filehandle.

Use sysread to read one byte at a time, or set the filehandle nonblocking and read (say) 256 at a time, but use select to wait for more to arrive.

Andrew.

(Hrm, I think untitled nodes should be given default names so we can click on them in newest nodes)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-30 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found