NAME

Net::IP::Match::XS2 - Perl extension for match IP address against Net ranges

SYNOPSIS

use Net::IP::Match::XS2;

my $ipr = Net::IP::Match::XS2->new();
$ipr->add("10.1.1.0", 25);
...
$ipr->add("192.168.2.128", 26);

$cidr = $ipr->match_ip("192.168.2.131");

DESCRIPTION

This module is XS implementation of matching IP address against Net ranges. Using similar method to Net::IP::Match::Regexp in storing Net ranges into memory. By implementing in XS C-code, more fast setup time than Regexp module. This module is useful when Net ranges change often.

METHODS

new()

Create IP range object and initialize it.

$ipr->add( $net, $mask )

Add an IP address ($net) into the object. $mask is 1 .. 32 CIDR mask bit value.

$cidr = $ipr->match_ip( $ip )

Searches matching $ip against previously setup networks. Returns matched Network in CIDR format (xxx.xxx.xxx.xxx/nnn). or undef unless matched.

SEE ALSO

Net::IP::Match::Regexp

AUTHOR

Tomo, <tomo at c-wind com>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Tomo

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.