+my $blocking_supported = 0;
+
+BEGIN {
+ # Checks if blocking is supported
+ eval {
+ require POSIX; POSIX->import(qw (F_SETFL F_GETFL O_NONBLOCK));
+ };
+ $blocking_supported = 1 unless $@;
+
+ # import as many of these errno values as are available
+ eval {
+ require Errno; Errno->import(qw(EAGAIN EINPROGRESS EWOULDBLOCK));
+ };
+}
+
+my $w = $^W;
+$^W = 0;
+my $eagain = eval {EAGAIN()};
+my $einprogress = eval {EINPROGRESS()};
+my $ewouldblock = eval {EWOULDBLOCK()};
+$^W = $w;