Skip Menu |

This queue is for tickets about the IO-Multiplex CPAN distribution.

Report information
The Basics
Id: 60068
Status: resolved
Priority: 0/
Queue: IO-Multiplex

People
Owner: Nobody in particular
Requestors: khedin [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.10
Fixed in: (no value)



Subject: [patch] WARN when adding a pipe to IO::Multiplex
When I add a pipe to IO::Multiplex, it gives an undef warning because of a UDP check in add(): 2010-08-04 14:43:21 [21746] IO::Multiplex /usr/share/perl5/IO/Multiplex.pm:352 WARN: Use of uninitialized value $fh in unpack at /usr/share/perl5/IO/Multiplex.pm line 352. 2010-08-04 14:43:21 [21746] IO::Multiplex /usr/share/perl5/IO/Multiplex.pm:352 WARN: Use of uninitialized value $fh in numeric eq (==) at /usr/share/perl5/IO/Multiplex.pm line 352. This is the code around line 352: $self->{_fhs}{"$fh"}{udp_true} = (SOCK_DGRAM == unpack("i", scalar getsockopt($fh,Socket::SOL_SOCKET(),Socket::SO_TYPE()))); Of course, a pipe fd has no sockopts and therefore cannot be queried. Nevertheless, it's OK for IO::Select'ing. So I have written a patch for this.
Subject: io-mux-pipe-warn.patch
--- /usr/share/perl5/IO/Multiplex.pm 2008-09-15 12:17:50.000000000 +0400 +++ /home/kuvarin/Multiplex.pm 2010-08-04 14:49:42.000000000 +0400 @@ -349,8 +349,9 @@ nonblock($fh); autoflush($fh, 1); fd_set($self->{_readers}, $fh, 1); - $self->{_fhs}{"$fh"}{udp_true} = - (SOCK_DGRAM == unpack("i", scalar getsockopt($fh,Socket::SOL_SOCKET(),Socket::SO_TYPE()))); + my $sockopt = scalar getsockopt($fh,Socket::SOL_SOCKET(),Socket::SO_TYPE()); + $self->{_fhs}{"$fh"}{udp_true} = (defined $sockopt) and + (SOCK_DGRAM == unpack("i", $sockopt)); $self->{_fhs}{"$fh"}{inbuffer} = ''; $self->{_fhs}{"$fh"}{outbuffer} = ''; $self->{_fhs}{"$fh"}{fileno} = fileno($fh);
There should be "&&" in the patch instead of "and", of course.
Will be fixed in 1,11 Thanks for the contribution.