not exactly. from the sysread doc:
Returns the number of bytes actually read, 0 at end of file, or undef if there was an error.
this is the full logic, but it can be condensed to fit your needs.
if( defined $read_bytes )
{
if( $read_bytes >= 0 )
{
print 'read something';
if( $read_bytes == $num_bytes )
{
print 'read full buffer';
}
elsif( $read_bytes < $num_bytes )
{
print 'buffer length: ', $num_bytes, ' read length: ', $read_by
+tes;
}
else
{
die 'how did i get here?';
}
}
elsif( $read_bytes == 0 )
{
print 'EOF';
}
else
{
die 'how did i get here?';
}
}
else
{
die 'error reading socket';
}
~Particle *accelerates*
|