How can I read from an IO::Socket::INET filehandle only if there is a complete line?

When reading from a IO::Socket::INET filehandle it can not be assumed that there will always be data available on the stream. What techniques are available to either peek at the stream to check if data is available or when doing the read take no data without a valid line termination and immediately pass through the read?

Answers


Set the Blocking option to 0 when creating the socket:

$sock = IO::Socket::INET->new(Blocking => 0, ...);

Need Your Help

How to edit menu in header - wordpress

html css wordpress

I need help on how to start editing the header on my wordpress site.I am using google chrome and the developers tool. I am a bit lost on how to pick out css properties and edit them myself and would

Webcam Live Broadcast android

android webcam broadcasting

Yesterday when I was searching for different kinds of apps in Google Play, I found several apps that broadcast live camera feed from the mobile. I made some research like what would be the concept....

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.