Skip Menu |

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

Report information
The Basics
Id: 75976
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: NetAddr-IP

People
Owner: Nobody in particular
Requestors: GRUBER [...] cpan.org
Cc:
AdminCc:

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



Subject: Change in behavior when passing an empty string to the constructor
I am not 100% sure it is a bug, but in our code we've been relying on old behavior. Compare: $ perl -MNetAddr::IP -MData::Dump -le 'print $NetAddr::IP::VERSION; my $l = NetAddr::IP->new(""); dd $l;' 4.027 undef $ perl -MNetAddr::IP -MData::Dump -le 'print $NetAddr::IP::VERSION; my $l = NetAddr::IP->new(""); dd $l;' 4.059 bless({ addr => "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", isv6 => 0, mask => pack("H*","ffffffffffffffffffffffffffffffff"), }, "NetAddr::IP") Not sure which version the behavior has changed, but 4.058 behaves the same as 4.059. Thanks, \Anton.
Full support for Math::BigInt numbers was added to NetAddr::IP in version 4.050. At that time it was noted that the behavior for ->new() has always returned 'default' i.e. 0.0.0.0/0 or ::/0 when the argument is undefined. Without a great deal of thought, this was extended to cover the case where the string was empty. When the input is defined but does not contain a valid IP format, the behavior is currently not covered in the documentation or addressed in the code itelf. In the next update, I will document this case and add code to return 'undef' when the input argument is defined and an empty string.