SYNOPSIS
use Net::IPNetMember;
$ipnets = new Net::IPNetMember();
$ipnets->add(group name, network block, netmask);$ipnets->add(group name, network block/prefix);$IPNet = $ipnets->find(IP);
DESCRIPTION
Net::IPNetMember creates groups of IP networks and allows searching for specific IPs, giving the name of the network group they belong to.
For example:
use Net::IPNetMember;
$ipnets = new Net::IPNetMember();
$ipnets->add("New York", "210.210.10.0", "255.255.255.0");$ipnets->add("New York", "210.210.11.0", "255.255.255.0");$ipnets->add("New York", "210.210.12.0", "255.255.254.0");$ipnets->add("Rio de Janeiro", "200.255.49.128", "255.255.255.128");$ipnets->add("Rio de Janeiro", "200.255.50.0", "255.255.252.0");$ipnets->add("Rio de Janeiro", "200.255.60.0", "255.255.255.0");$ipnets->add("RfC1918", "192.168.0.0/16");$ipnets->add("RfC1918", "172.16.0.0/12");$ipnets->add("RfC1918", "10.0.0.0/8");$ipnets->add("MyLocalNetwork", "192.168.215.0/24");
$City = $ipnets->find("200.255.60.10"); # $City will be set to "Rio de Janeiro"$rfcaddress = $ipnets->find("192.168.10.160"); # $rfcaddress will be "RfC1918"$rfcaddress = $ipnets->find("192.168.215.31"); # $rfcaddress will be "MyLocalNetwork"# it's the most specific networkif ( $City = $ipnets->find("210.210.9.5") ) # Will be false
COPYRIGHT
Copyright (C) 2001 Marc Haber. All rights reserved. This program isfree software; you can redistribute it and/or modify it under the sameterms as Perl itself.
Marc Haber <[email protected]>
This is a fork from Net::GrpNetworks, Copyright (c) 1997 AndreRodrigues Viegas <[email protected]>. All rights reserved.This program is free software; you can redistribute it and/or modifyit under the same terms as Perl itself.
I offered Andre my code to incorporate into Net::GrpNetworks, butunfortunately, he stopped answering to my e-mails before anythingcould be accomplished. Hence, I had to fork. I still think that bothcode bases should be brought together again, but responsive upstreamis needed for that.
AUTHOR
Marc Haber <[email protected]>. Taken from Andre's original man page