Net::Works - Sane APIs for IP addresses and networks
The NetAddr::IP module is very complete, correct, and useful. However, it's API design is a bit crufty. This distro provides wrappers around NetAddr::IP that aim to address the biggest problems with that module's API, as well as adding some additional features.
If you're using this module to work with IPv6 addresses, then you'll end up creating big integers at some point. We strongly recommend that you install Math::BigInt::GMP or Math::BigInt::Pari. The default pure Perl implementation of big integers can be very, very slow.
Here are some of the key differences between the two distributions:
Net::Works provides two classes,
one for single IP addresses and one for networks (and subnets).
With NetAddr::IP a single address is represented as a /32 or /128 subnet.
Net::Works allows you to construct an IP address from a string ("18.104.22.168") or an integer (1097).
You can get the next and previous address from Net::Works::Address object, regardless of whether or not that address is in the same subnet.
If you pass bad data to a constructor you'll get an exception.
The iterator provided by Net::Works::Network has no confusing special cases.
It always returns all the addresses in a network,
including the network and broadcast addresses.
$network->last() do not return different results for different sized networks.
The Net::Works::Network class provides a
Net::Works::Network->range_as_subnets method that takes a start and end IP address and splits this into a set of subnets that include all addresses in the range.
This distro does not wrap every method provided by NetAddr::IP. Patches to add more wrappers are welcome, however.
Please report any bugs or feature requests to
or through the web interface at http://rt.cpan.org.
I will be notified,
and then you'll automatically be notified of progress on your bug as I make changes.
This software is Copyright (c) 2012 by MaxMind, Inc..
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)