Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
Net::IP::Resolver(3) User Contributed Perl Documentation Net::IP::Resolver(3)

Net::IP::Resolver - Resolve IPs to a particular network

  # Create the resolver and add some networks
  my $resolver = Net::IP::Resolve->new;
  $resolver->add( 'Comcast' => '', '' );
  $resolver->add( 'Foobar'  => [ '', '' ] );
  # Check an IP
  my $ip = '';
  my $network = $resolver->find_first( $ip );
  print "IP $ip is in network $network";
  # prints... "IP is in network Comcast";

"Net::IP::Resolver" provides a mechanism for registering a number of different networks (specified by a set of ip ranges), and then finding the network for a given IP based on this specification.
The identifier for a network can be any defined value that you wish.
Thus you can resolve to numeric identifiers, names, or even to objects representing the networks.

The "new" constructor takes no arguments, and create a new and empty resolver.
Returns a new "Net::IP::Resolver" object.

The "add" method adds a network to the resolver. It takes as argument an identifier for the network, which can be "any" defined value, including an object of any type, followed by a set of 1 or more IP ranges, in the format used by Net::IP::Match::XS (which this class uses for the actual ip matching).
Returns true if the network was added, or "undef" if passed incorrect arguments.

The "find_first" method takes an IP address as argument, and checks it against each network to find the first one that matches.
The assumption made by "find_first" is that each network in the resolver occupies a unique and non-overlapping set of ranges, and thus only any ip can only ever resolve to one network
Returns the network identifier as originally provided, or "undef" if the ip is not provided, or the resolver cannot match it to any network.

All bugs should be filed via the bug tracker at
For other issues, or commercial enhancement and support, contact the author

Adam Kennedy <>

Net::IP, Net::IP::Match::XS, <>

Copyright 2005 - 2006 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
2006-09-04 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.