Skip Menu |

This queue is for tickets about the Net-IP CPAN distribution.

Report information
The Basics
Id: 117834
Status: new
Priority: 0/
Queue: Net-IP

People
Owner: Nobody in particular
Requestors: stephen.baynes [...] smoothwall.net
Cc:
AdminCc:

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



Subject: intip returns 0 ofor 0.0.0.0
Date: Wed, 14 Sep 2016 16:26:41 +0100
To: bug-Net-IP [...] rt.cpan.org
From: Stephen Baynes <stephen.baynes [...] smoothwall.net>
Found in Net::IP 1.26 Was OK in 1.25. intip returns undef (or empty array depending on context) if the IP is 0.0.0.0 It is caused by the following code in my $int = ip_bintoint($self->binip()); if (!$int) { $self->{error} = $ERROR; $self->{errno} = $ERRNO; return; } In the case of 0.0.0.0 then int is 0 so the body of the if is executed. I think it should be: if ( ! defined $int ) { ... [ Also I recommend return undef; rather than just return; consider the following code: my $h = { a => $ip->intip(), b => something" }; will effectively do my $h = { a=>b, "something" }; in this case. Scalar valued functions should use return undef; and keep just return; for what a C programmer would call a void valued function. ] Probably the same issue as reported in bug 107926 but disagree about the cause. I see similar code in other methods so they probably need to be fixed too.