summaryrefslogtreecommitdiff
path: root/ext/IO
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-22 04:45:57 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-22 04:45:57 +0000
commite541f5e7702d28bc5ed83b5b23cf57d476b829cb (patch)
tree248940146da27a262c56c00afe9c04a5bcde9abe /ext/IO
parenta05b299fc7b2536d7c32061e1a048ddbdd4b4496 (diff)
downloadperl-e541f5e7702d28bc5ed83b5b23cf57d476b829cb.tar.gz
use same treatment for EINVAL as for ETIMEDOUT
p4raw-id: //depot/perl@5188
Diffstat (limited to 'ext/IO')
-rw-r--r--ext/IO/lib/IO/Socket/INET.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/IO/lib/IO/Socket/INET.pm b/ext/IO/lib/IO/Socket/INET.pm
index af64c9603e..696e988802 100644
--- a/ext/IO/lib/IO/Socket/INET.pm
+++ b/ext/IO/lib/IO/Socket/INET.pm
@@ -12,11 +12,13 @@ use IO::Socket;
use Socket;
use Carp;
use Exporter;
-use Errno qw(EINVAL); # EINVAL appears portable
+use Errno;
@ISA = qw(IO::Socket);
$VERSION = "1.25";
+my $EINVAL = exists(&Errno::EINVAL) ? Errno::EINVAL() : 1;
+
IO::Socket::INET->register_domain( AF_INET );
my %socket_type = ( tcp => SOCK_STREAM,
@@ -117,7 +119,7 @@ sub configure {
$laddr = defined $laddr ? inet_aton($laddr)
: INADDR_ANY;
- return _error($sock, EINVAL, "Bad hostname '",$arg->{LocalAddr},"'")
+ return _error($sock, $EINVAL, "Bad hostname '",$arg->{LocalAddr},"'")
unless(defined $laddr);
$arg->{PeerAddr} = $arg->{PeerHost}
@@ -139,7 +141,7 @@ sub configure {
if(defined $raddr) {
@raddr = $sock->_get_addr($raddr, $arg->{MultiHomed});
- return _error($sock, EINVAL, "Bad hostname '",$arg->{PeerAddr},"'")
+ return _error($sock, $EINVAL, "Bad hostname '",$arg->{PeerAddr},"'")
unless @raddr;
}
@@ -169,13 +171,13 @@ sub configure {
$raddr = shift @raddr;
- return _error($sock, EINVAL, 'Cannot determine remote port')
+ return _error($sock, $EINVAL, 'Cannot determine remote port')
unless($rport || $type == SOCK_DGRAM || $type == SOCK_RAW);
last
unless($type == SOCK_STREAM || defined $raddr);
- return _error($sock, EINVAL, "Bad hostname '",$arg->{PeerAddr},"'")
+ return _error($sock, $EINVAL, "Bad hostname '",$arg->{PeerAddr},"'")
unless defined $raddr;
# my $timeout = ${*$sock}{'io_socket_timeout'};
@@ -192,7 +194,7 @@ sub configure {
# if ($timeout) {
# my $new_timeout = $timeout - (time() - $before);
# return _error($sock,
-# (exists(&Errno::ETIMEDOUT) ? &Errno::ETIMEDOUT : EINVAL),
+# (exists(&Errno::ETIMEDOUT) ? Errno::ETIMEDOUT() : $EINVAL),
# "Timeout") if $new_timeout <= 0;
# ${*$sock}{'io_socket_timeout'} = $new_timeout;
# }