Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Reading non-blockingly / "awk has to be better for something."

by james2vegas (Chaplain)
on Jul 28, 2012 at 08:49 UTC ( #984161=note: print w/replies, xml ) Need Help??


in reply to Reading non-blockingly / "awk has to be better for something."

Yes there is, set your $fh non-blocking (IO::Handle's blocking method) and use IO::Handle's getline method on $fh, bearing in mind that getline will return undef (ending a while loop) when there isn't a line to read (<$fh> would also work non-blockingly, so getline is not strictly necessary)

As for the other issue, just split your returned line on "\n".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984161]
help
Chatterbox?
[stevieb]: aaaand Mickey fixed the MetaCPAN::Client bug I just finished talking about already ;)
[stevieb]: Fixed in 2.017000

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-06-25 23:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.