Net::Subnet::Count is a Perl module to count hosts in named subnets.
SYNOPSIS
use Net::Subnet::Count;
use IP::Address;
my $counter = new Net::Subnet::Count;
$counter->add('subnet-00', new IP::Address("10.0.0.0/24"));
$counter->add('other', @array_of_ip_addresses);
$counter->add('other', @another_array_of_ip_addresses);
$counter->cache(10);
$counter->count(new IP::Address("10.0.3.17"));
$counter->count(@array_of_ip_addresses);
$counter->valcount(new IP::Address("10.0.3.17"), 23);
@array_of_ipaddr_and_values = (new IP::Address("10.0.3.17"), 23,
new IP::Address("101.0.23.107"), 2);
$counter->valcount(@array_of_ipaddr_and_values);
my $r_count = $counter->result;
foreach my $subnet (keys %{$r_count}) {
print "Subnet $subnet had ", $r_count->{$subnet}, " visits.
";
}
This module implements a symplistic way to match individual IP Addresses to subnets. It can be used to, among other things, help analyze HTTPD logs.
Product's homepage
Requirements:
· Perl