Skip Menu |

This queue is for tickets about the IO CPAN distribution.

Report information
The Basics
Id: 59984
Status: resolved
Priority: 0/
Queue: IO

Owner: Nobody in particular
Requestors: leonerd-cpan [...]

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)

Subject: Always call IO::Socket->configure even with no %args
Download (untitled) / with headers
text/plain 1.3k
Currently, IO::Socket::new tests if any named arguments are present, and does not call ->configure if there are no arguments. It's the actual configure method that creates a socket handle (by a call to ->socket), so without this, no further methods will work correctly. In particular, the following code does not work: my $sock = IO::Socket::UNIX->new; $sock->setsockopt( .... ); $sock->bind( pack_sockaddr_un( $path ) ); Because the configure method doesn't actually check the full set of named keys, it'll accept anything, so the following works fine my $sock = IO::Socket::UNIX->new( DummyToKeepIOSocketHappy => 1 ); ... Is there any actual implementation reason why this call has to be conditional? I've tried simply making the call unconditional in the IO dist, and all tests still pass. There's often times, such as when creating PF_PACKET sockets, that I'll want to create a socket handle to set some options (such as a packet filter), before the eventual ->bind() call to attach it to some interface. It's useful to be able to get an unconfigured but still opened filehandle in this case. Rather than await a 'yes', I'll fork+patch+docs+tests on github anyway, and submit you a pull request, and you can decide on the merits there. This will also include a fix for which I am also working on. Thanks, -- Paul Evans
Ticket migrated to github as

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to