A NetAddr::IP Trial Release

After years of quiet, NetAddr::IP has a new maintainer and a new trial release. If you use this module for IPv4/IPv6 address manipulation, here's what you need to know.

Breaking Changes

There are three breaking changes in 4.080_01. Before you reach for the pitchforks, they're all cases where the old behaviour was a bug, not a feature:

  • re() on IPv6 objects in IPv4 space no longer emits a broken regex (GH#34). Previously it returned a regex that couldn't match anything useful.
  • re6() now returns a non-capturing group (?:...) (GH#50). The old capturing group was almost never what the caller wanted.
  • new(undef) returns undef instead of the default route (GH#29). Passing undef to a constructor should not silently give you 0.0.0.0/0.

All three are cases where the documented or sensible behaviour was different from what the code actually did. If your code relied on the old behaviour, it was already broken -- you just hadn't noticed yet.

Deprecation

The :rfc3021 export tag is deprecated (GH#26). hostenum/hostenumref now return 2 hosts for /31 and /127 unconditionally, matching the RFC. The dead $rfc3021 variable has been removed (GH#63).

Bug Fixes (Selected)

The release includes fixes for a number of long-standing bugs. Some highlights:

  • coalesce now counts subnet addresses, not usable hosts (GH#37)
  • coalesce works on subclass objects (GH#38)
  • coalesce validates its arguments and croaks on bad input (GH#40)
  • new6() prefers AAAA over A for dual-stack hostnames (RT#119858, GH#32)
  • new6() returns compatible form for IPv4-only hosts (GH#64)
  • :nofqdn import tag actually works now (RT#111301, GH#1)
  • canon/short compress the first equal-length zero run per RFC 5952 (GH#13)

Plus neg/abs overloads (GH#67), bracket notation fixes (GH#68), and many more. See the full Changes for the complete list.

Test Suite Modernisation

The entire test suite -- 157 files, nearly 3,000 tests -- has been converted from bespoke TAP output to Test2::V1. The tests now run cleanly on Perl 5.14 through 5.42 on Linux and macOS (Intel and ARM). The XS and pure-Perl code paths are both covered in CI.

Try It Out

This is a trial release. Install it with:

cpanm DJZORT/NetAddr-IP-4.080_01.tar.gz

or clone the repo:

git clone https://github.com/cpan-authors/perl-NetAddr-IP.git
cd perl-NetAddr-IP
dzil test

If you find regressions, open an issue on GitHub. The more smoke reports, the better the stable release will be.

Leave a comment

About Dean

user-pic I blog about Perl. I am back in Sydney