NAME Net::IP::Resolver - Resolve IPs to a particular network SYNOPSIS # Create the resolver and add some networks my $resolver = Net::IP::Resolve->new; $resolver->add( 'Comcast' => '220.127.116.11/8', '18.104.22.168/10' ); $resolver->add( 'Foobar' => [ '22.214.171.124/24', '126.96.36.199/24' ] ); # Check an IP my $ip = '188.8.131.52'; my $network = $resolver->find_first( $ip ); print "IP $ip is in network $network"; # prints... "IP 184.108.40.206 is in network Comcast"; DESCRIPTION "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. METHODS new The "new" constructor takes no arguments, and create a new and empty resolver. Returns a new "Net::IP::Resolver" object. add $network, $range, ... 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. find_first $ip 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. SUPPORT All bugs should be filed via the bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IP-Resolver> For other issues, or commercial enhancement and support, contact the author AUTHORS Adam Kennedy <firstname.lastname@example.org> SEE ALSO Net::IP, Net::IP::Match::XS, <http://ali.as/> COPYRIGHT 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.