NAME

Net::CIDR::Lite - Perl extension for merging IPv4 CIDR addresses

SYNOPSIS

use Net::CIDR::Lite;

my $cidr = Net::CIDR::Lite->new;
$cidr->add($cidr_address);
@cidr_list = $cidr->list;

DESCRIPTION

Faster alternative to Net::CIDR. Works for IPv4 and IPv6 addresses.

METHODS

new()
$cidr = Net::CIDR::Lite->new

Creates an object to represent a list of CIDR address ranges. No particular format is set yet; once an add method is called with a IPv4 or IPv6 format, only that format may be added for this cidr object.

add()
$cidr->add($cidr_address)

Adds a CIDR address range to the list.

add_range()
$cidr->add_range($ip_range)

Adds a hyphenated IP address range to the list.

add_cidr()
$cidr1->add_cidr($cidr2)

Adds address ranges from one object to another object.

add_ip()
$cidr->add_ip($ip_address)

Adds a single IP address to the list.

$cidr->clean()
$cidr->clean;

If you are going to call the list method more than once on the same data, then for optimal performance, you can call this to purge null nodes in overlapping ranges from the list. Boundary nodes in contiguous ranges are automatically purged during add().

$cidr->list()
@cidr_list = $cidr->list;
$list_ref  = $cidr->list;

Returns a list of the merged CIDR addresses. Returns an array if called in list context, an array reference if not.

CAVEATS

Garbage in/garbage out. This module does validate ip address formats but does not (yet) validate the cidr mask value.

AUTHOR

Douglas Wilson, <dougw@cpan.org> w/numerous hints and ideas borrowed from Tye McQueen.

COPYRIGHT

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

SEE ALSO

Net::CIDR.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 238:

'=item' outside of any '=over'

Around line 288:

You forgot a '=back' before '=head1'