http://qs321.pair.com?node_id=67533

Item Description: Manipulates IP addresses, masks, and subnets

Review Synopsis:

Description
NetAddr::IP provides a simple interface to the tedious bit manipulation involved when handling IP address calculations. It also helps by performing range comparisons between subnets as well as other frequently used functions such as:

It can also return results in either CIDR notation (10.1.1.1/24) or regular Mask notation (10.1.1.1 255.255.255.0). You can also return addresses without masks, or masks without addresses.

Who should use it?

Anyone who needs to perform complex operations on IP addresses, such as determining a subnet address for a given address, or a quick way to determine if address/subnet A is in subnet B. Saves a lot of time with binary conversions.

Who should NOT use it?

Anyone who is running on a system that may have endian problems -- the author clearly states in the documentation that it has not been extensively tested on a range of platforms. Be careful.

Documentation

Complete and very well presented, with plenty of examples.

Personal Notes

I've used this module extensively for subnet determination and address manipulation, and it worked extremely well (at least on Linux/Intel, there were no endian problems). The documentation is clear and simple. Recommended!

Replies are listed 'Best First'.
Re: NetAddr::IP
by fokat (Deacon) on Nov 08, 2002 at 04:46 UTC
    Thanks a lot for the positive review. Just to add a few points:

    • Additional formats supported:

      • "Range" notation such as in 10.10.10.0-255 for 10.10.10/24

      • Cisco's wildcard notation

      • inet_aton and inet_ntoa to feed directly to old-style socket calls

    • The code has been tested in the following platforms by the author: Solaris/Sparc, Linux/Intel, FreeBSD/Intel, Win32/Intel, Digital Unix/Alpha, HP-UX/PA-RISC, Mac OS X/PPC. No reports of endianness-related problems have been received so far.

    If you're running a version earlier than 3.00, please do consider upgrading. 3.xx includes vast performance improvements in many operations as well as a simpler internal representation guaranteed to be portable to any machine with 32 bits integers.

    Best regards

    -lem, but some call me fokat

    Update: I mistakenly mentioned 3.20 before it came into existence. Current versions as of this writing are 3.14 (production) and 3.14_1 (development, with fresh patches for IPv6).

      Thanks. Out of curiosity, where do you get 3.20? The newest version in CPAN seems to be 3.14.
      "Non sequitur. Your facts are un-coordinated." - Nomad
        My mistake. 3.14 and 3.14_1 are the latest versions. The latest version will always be at CPAN.

        Best regards

        -lem, but some call me fokat