Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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:

  • Checks to see if a host address or subnet is contained within another subnet
  • Count number of host addresses in a subnet
  • Enumeration of host addresses in a subnet
  • Calculate the Subnet or broadcast address of a given IP address and mask
  • Validation of host or subnet addresses
  • Compact subnets or addresses into the largest possible CIDR block
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!

In reply to NetAddr::IP by Clownburner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2021-12-03 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?