[perl #22965] Cannot set undef timeout in IO::Socket in perl 5.8.0
Hrunting Johnson [Mon, 14 Jul 2003 05:37:02 +0000 (05:37 +0000)]
From: Hrunting Johnson (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-22965-60791.13.0539297217452@rt.perl.org>

p4raw-id: //depot/perl@20193

ext/IO/lib/IO/Socket.pm

index 7f434d9..f8c3cb3 100644 (file)
@@ -273,9 +273,9 @@ sub atmark {
 sub timeout {
     @_ == 1 || @_ == 2 or croak 'usage: $sock->timeout([VALUE])';
     my($sock,$val) = @_;
-    my $r = ${*$sock}{'io_socket_timeout'} || undef;
+    my $r = ${*$sock}{'io_socket_timeout'};
 
-    ${*$sock}{'io_socket_timeout'} = 0 + $val
+    ${*$sock}{'io_socket_timeout'} = defined $val ? 0 + $val : $val
        if(@_ == 2);
 
     $r;