--- NTP.pm 2004-02-23 18:53:47.000000000 +0100
+++ /usr/share/perl5/Net/NTP.pm 2008-08-06 07:45:49.000000000 +0200
@@ -141,15 +141,22 @@
sub get_ntp_response{
use IO::Socket;
+ use constant HAVE_SOCKET_INET6 => eval { require IO::Socket::INET6 };
my $host = shift || 'localhost';
my $port = shift || 'ntp';
- my $sock = IO::Socket::INET->new(
+ my %args = (
Proto => 'udp',
PeerHost => $host,
- PeerPort => $port )
- or die $@;
+ PeerPort => $port );
+ my $sock;
+ if (HAVE_SOCKET_INET6) {
+ $sock = IO::Socket::INET6->new(%args);
+ } else {
+ $sock = IO::Socket::INET->new(%args);
+ }
+ die $@ unless $sock;
my %tmp_pkt;
my %packet;