X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FMsg.pm;h=f925681841c0746e44b7e7ee0d65b31d11a9c20c;hb=07b08c6f048732431ae45b34463387f17d68b823;hp=b7be27d3e272ebc3bb780dffef736206b11ee46e;hpb=a711fc132a7e18e67def6abeba3f8d18bbaae72f;p=spider.git diff --git a/perl/Msg.pm b/perl/Msg.pm index b7be27d3..f9256818 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -15,8 +15,6 @@ use IO::Select; use IO::Socket; use DXDebug; use Timer; -use Errno qw(EWOULDBLOCK EAGAIN EINPROGRESS); -use POSIX qw(F_GETFL F_SETFL O_NONBLOCK); use vars qw(%rd_callbacks %wt_callbacks %er_callbacks $rd_handles $wt_handles $er_handles $now %conns $noconns); @@ -33,9 +31,14 @@ my $blocking_supported = 0; BEGIN { # Checks if blocking is supported eval { - require POSIX; POSIX->import(qw (F_SETFL O_NONBLOCK)); + 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; @@ -155,7 +158,7 @@ sub connect { my $ip = gethostbyname($to_host); # my $r = $sock->connect($to_port, $ip); my $r = connect($sock, pack_sockaddr_in($to_port, $ip)); - return undef unless $r || _err_will_block($r); + return undef unless $r || _err_will_block($!); $conn->{sock} = $sock;