0
  7   eˆl–äY>”d*ClÊ�zà¸ËJbÑ¿�þZ ¥Y²ºôŽ	÷G�üÿè„�2çÂä ?÷     e=head1 NAME

 Net::Netmask - parse, manipulate and lookup IP network blocks

=head1 SYNOPSIS

 use Net::Netmask;

 $block = Net::Netmask->safe_new(network block)
 $block = Net::Netmask->safe_new(network block, netmask)
 $block = Net::Netmask->new2(network block)
 $block = Net::Netmask->new2(network block, netmask)
 $block = Net::Netmask->new(network block)   # Don't use in new code!
 $block = Net::Netmask->new(network block, netmask)   # Don't use in new code!

 print $block;                      # a.b.c.d/bits or 1:2:3::4/bits
 print $block->base()
 print $block->mask()
 print $block->hostmask()
 print $block->bits()
 print $block->size()
 print $block->maxblock()
 print $block->broadcast()
 print $block->next()
 print $block->match($ip);
 print $block->nth(1, [$bitstep]);
 print $block->protocol();

 if ($block->sameblock("network block")) ...
 if ($block->cmpblocks("network block")) ...

 $newblock = $block->nextblock([count]);

 for $ip ($block->enumerate([$bitstep])) { }

 for $zone ($block->inaddr()) { }

 my $table = {};
 $block->storeNetblock([$table])
 $block->deleteNetblock([$table])
 @missingblocks = $block->cidrs2inverse(@blocks)

 $block = findNetblock(ip, [$table])
 $block = findOuterNetblock(ip, [$table])
 @blocks = findAllNetblock(ip, [$table])
 if ($block->checkNetblock([$table]) ...
 $block2 = $block1->findOuterNetblock([$table])
 @blocks = dumpNetworkTable([$table])

 @blocks = range2cidrlist($beginip, $endip);
 @blocks = cidrs2cidrs(@blocks_with_dups)

 @listofblocks = cidrs2contiglists(@blocks);

 @blocks = sort @blocks
 @blocks = sort_network_blocks(@blocks)

 @sorted_ip_addrs = sort_by_ip_address(@unsorted_ip_addrs)

=head1 DESCRIPTION

Net::Netmask parses and understands IPv4 and IPv6 CIDR blocks (see
L<https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing>
for more information on CIDR blocks).  It's built with an
object-oriented interface, with functions being methods that
operate on a Net::Netmask object.

These methods provide nearly all types of information about a
network block that you might want.

There are also functions to insert a network block into a table
and then later lookup network blocks by IP address using that table.
There are functions to turn a IP address range into a list of
CIDR blocks.  There are functions to turn a list of CIDR blocks
into a list of IP addresses.

There is a function for sorting by text IP address.

All functions understand both IPv4 and IPv6.  Matches, finds, etc,
will always return false when an IPv4 address is matched against
an IPv6 address.

IPv6 support was added in 1.9104.

=head1 CONSTRUCTING

Net::Netmask objects are created with an IP address and optionally
a mask.  There are many forms that are recognized:

=over 32

=item '216.240.32.0/24'

The preferred IPv4 form.

=item '216.240.32.0:255.255.255.0'

=item '216.240.32.0-255.255.255.0'

=item '216.240.32.0', '255.255.255.0'

=item '216.240.32.0', '0xffffff00'

=item '216.240.32.0 - 216.240.32.255'

=item '216.240.32.4'

A /32 block.

=item 'default' or 'any'

0.0.0.0/0 (the default route)

=item '216.240.32.0#0.0.31.255'

A hostmask (as used by Cisco access-lists - that is, the hostmask
is the bitwise inverse of a netmask).

=item '2001:db8:1234:5678::/64'

The preferred IPv6 form.

=item '2001:db8:1234:5678::9876'

A /128 block.

=item 'default6' or 'any6'

::/0 (the default route)

=back

There are two constructor methods: C<new> and C<safe_new> (also known as C<new2>).

C<safe_new> differs from C<new> in that it will return undef for invalid netmasks,
while C<new> will return a netmask object even if the constructor
could not figure out what the network block should be.

With C<new>, the error string can be found as $block->{'ERROR'}.  With
C<safe_new> the error can be found as Net::Netmask::errstr or $Net::Netmask::error.

IMPORTANT: You want to use C<safe_new> or C<new2> (C<new2> is a synonym
for C<safe_new>) in new code!

As of version 2.000, the following abbreviated IPv4 netblocks are not accepted
by defaul