The IP class allows a comfortable parsing and handling for most notations in use for IPv4 and IPv6 addresses and networks. It was greatly inspired by RIPE’s Perl module NET::IP’s interface but doesn’t share the implementation. It doesn’t share non-CIDR netmasks, so funky stuff like a netmask of 0xffffff0f can’t be done here. It can detect about a dozen different ways of expressing IP addresses and networks, parse them and distinguish between IPv4 and IPv6 addresses. Nearly all class methods which return a string have an optional parameter ‘wantprefixlen’ which controls if the prefixlen or netmask is printed. ...