Subject: | Incomplete range compaction |
Date: | Fri, 12 Dec 2014 14:25:11 -0500 |
To: | bug-Net-CIDR-Lite [...] rt.cpan.org |
From: | Stephen Cristol <stephen [...] bee.net> |
Problem:
Net::CIDR::Lite is not compacting a range as expected.
===========================================
Code:
#!/usr/bin/perl
use 5.010;
use Net::CIDR::Lite;
my $cidr = Net::CIDR::Lite->new();
$cidr->add( '185.58.116.0/22' );
$cidr->add( '185.58.120.0/23' );
$cidr->add( '185.58.122.0/24' );
$cidr->add( '185.58.123.0/24' );
my $cidr_list = $cidr->list();
say join "\n", @$cidr_list;
===========================================
Output:
185.58.116.0/22
185.58.120.0/22
Expected output:
185.58.116.0/21
===========================================
Environment:
CentOS 6.6 (Linux 2.6.32-504.1.3.el6.i686)
perl 5.12.4
perl-Net-CIDR-Lite-0.21 (from perl-Net-CIDR.noarch 0.13-1.el6.rf)