=== modified file 'lib/IO/Socket/IP.pm'
--- lib/IO/Socket/IP.pm 2015-01-10 21:04:10 +0000
+++ lib/IO/Socket/IP.pm 2015-01-11 16:30:55 +0000
@@ -820,11 +820,11 @@
=cut
-sub sockhost { my $self = shift; ( $self->_get_host_service( $self->sockname, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
-sub sockport { my $self = shift; ( $self->_get_host_service( $self->sockname, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
+sub sockhost { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
+sub sockport { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
-sub sockhostname { my $self = shift; ( $self->_get_host_service( $self->sockname, 0, NIx_NOSERV ) )[0] }
-sub sockservice { my $self = shift; ( $self->_get_host_service( $self->sockname, 0, NIx_NOHOST ) )[1] }
+sub sockhostname { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, 0, NIx_NOSERV ) )[0] }
+sub sockservice { my $self = shift; scalar +( $self->_get_host_service( $self->sockname, 0, NIx_NOHOST ) )[1] }
=head2 $addr = $sock->sockaddr
@@ -873,11 +873,11 @@
=cut
-sub peerhost { my $self = shift; ( $self->_get_host_service( $self->peername, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
-sub peerport { my $self = shift; ( $self->_get_host_service( $self->peername, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
+sub peerhost { my $self = shift; scalar +( $self->_get_host_service( $self->peername, NI_NUMERICHOST, NIx_NOSERV ) )[0] }
+sub peerport { my $self = shift; scalar +( $self->_get_host_service( $self->peername, NI_NUMERICSERV, NIx_NOHOST ) )[1] }
-sub peerhostname { my $self = shift; ( $self->_get_host_service( $self->peername, 0, NIx_NOSERV ) )[0] }
-sub peerservice { my $self = shift; ( $self->_get_host_service( $self->peername, 0, NIx_NOHOST ) )[1] }
+sub peerhostname { my $self = shift; scalar +( $self->_get_host_service( $self->peername, 0, NIx_NOSERV ) )[0] }
+sub peerservice { my $self = shift; scalar +( $self->_get_host_service( $self->peername, 0, NIx_NOHOST ) )[1] }
=head2 $addr = $peer->peeraddr
=== modified file 't/02local-server-v4.t'
--- t/02local-server-v4.t 2015-01-02 19:39:50 +0000
+++ t/02local-server-v4.t 2015-01-11 16:30:55 +0000
@@ -43,6 +43,10 @@
ok( eval { $testserver->peerport; 1 }, "\$testserver->peerport does not die for $socktype" )
or do { chomp( my $e = $@ ); diag( "Exception was: $e" ) };
+ is_deeply( { host => $testserver->peerhost, port => $testserver->peerport },
+ { host => undef, port => undef },
+ 'peerhost/peersock yield scalar' );
+
my $socket = IO::Socket::INET->new(
PeerHost => "127.0.0.1",
PeerPort => $testserver->sockport,