Subject: | Overloaded comparison operators don't work as expected |
Distribution: NetAddr-IP-4.029
Perl version: This is perl, v5.8.9 built for darwin-2level
OS: Darwin 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT
2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
Firstly, while the equality operator 'eq' is overloaded, the operator
'ne' is not, and throws exceptions such as "Can't use string
("127.0.0.1") as a HASH ref while "strict refs" in use at
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/NetAddr/IP/Lite.pm
line 234" because it expects both comparitors to be objects.
Secondly, the 'eq' operator does not work as expected:
if (NetAddr::IP->new('127.0.0.1') eq '127.0.0.1') {
print "yes\n";
}
Intuitively, this comparison should match as the IP addresses are
identical, but it does not.