
Net::CIDR::Lookup::IPv6

This is the IPv6 version of Net::CIDR::Lookup.
It generally provides the same methods,
with the distinction that the add_num/add_num_range methods that accept an IPv4 address as an integer have been split in two to accommodate different representations for an IPv6 address:
add_vec/add_vec_range accepts a 128-bit Bit::Vector object for an addressadd_str/add_str_range takes a packed string as returned by Socket::unpack_sockaddr_in6For all other methods, see Net::CIDR::Lookup.
This module requires an IPv6-enabled Socket. As there is no way to ask for this using ExtUtils::MakeMaker, do make sure you have it.

See Net::CIDR::Lookup::IPv6::Changes

Arguments: $cidr,
$value
Return Value: none; dies on error
Adds VALUE to the tree under the key CIDR. CIDR must be a string containing an IPv6 address followed by a slash and a number of network bits. Bits to the right of this mask will be ignored.
Arguments: $range,
$value
Return Value: none; dies on error
Adds VALUE to the tree for each address included in RANGE which must be a hyphenated range of IPv6 addresses and with the first address being numerically smaller the second. This range will be split up into as many CIDR blocks as necessary (algorithm adapted from a script by Dr. Liviu Daia).
Arguments: $address,
$bits,
$value
Return Value: none; dies on error
Like add() but accepts an address as a Bit::Vector object and the network bits as a separate integer instead of all in one string.
Arguments: $address,
$bits,
$value
Return Value: none; dies on error
Like add_vec() but accepts an address as a packed string as returned by Socket::unpack_sockaddr_in6.
Arguments: $start,
$end,
$value
Return Value: none; dies on error
Like add_range() but accepts addresses as separate Bit::Vector objects instead of a range string.
Arguments: $start,
$end,
$value
Return Value: true for successful completion; dies on error
Like add_vec_range() but accepts addresses as packed strings as returned by Socket::unpack_sockaddr_in6.
Arguments: $address
Return Value: value assoiated with this address or undef
Looks up an IPv6 address specified as a string and returns the value associated with the network containing it. So far there is no way to tell which network that is though.
Arguments: $address
Return Value: value assoiated with this address or undef
Like lookup() but accepts the address as a Bit::Vector object.
Arguments: $address
Return Value: value assoiated with this address or undef
Like lookup() but accepts the address as a packed string as returned by Socket::unpack_sockaddr_in6.
Arguments: none
Return Value: $hashref
Returns a hash representation of the tree with keys being CIDR-style network addresses.
Arguments: $coderef to call for each tree entry.
Callback arguments are:
$addressThe network address as a Bit::Vector object. The callback must not change this object's contents, use $addr->Clone if in doubt!
$bitsThe current CIDR block's number of network bits
$valueThe value associated with this block
Return Value: nothing useful

undef value does not work and yields an error.
This would be relatively easy to fix at the cost of some memory so that's more a design decision.
Matthias Bethke <matthias@towiski.de>
Licensed unter the Artistic License 2.0

This module's methods are based even more loosely on Net::CIDR::Lite than those of Net::CIDR::Lookup.