Subject: | 61-217-102-8.hinet-ip.hinet.net accepted as 61.0.0.0 |
Date: | Thu, 10 Jan 2008 12:59:34 -0500 |
To: | bug-Net-IP [...] rt.cpan.org |
From: | Allen Chen <allen.chen [...] markmonitor.com> |
I use Net::IP to process the host portion of a URL as a test to see if
it is an IP address and to normalize it into dotted quad format. If the
Net::IP->new() fails, I treat the host as a hostname instead of an IP.
Strangely, Net::IP does not return any errors for
"61-217-102-8.hinet-ip.hinet.net" and instead parses it as 61.0.0.0.
Here is code to reproduce the bug:
#!/usr/bin/perl
use Net::IP;
my $ip = Net::IP->new('61-217-102-8.hinet-ip.hinet.net');
print " IP: " . $ip->ip() . "\n";
print "ERROR: " . Net::IP::Error() . "\n";
print "ERRNO: " . Net::IP::Errno() . "\n";
Here is the output from the above:
IP: 61.0.0.0
ERROR:
ERRNO:
I am using Net::IP 1.25 under perl 5.8.7.