Commit 66a2f4d6 authored by Nick Morrott's avatar Nick Morrott

Import Upstream version 0.18

parent 98b9d0b9
......@@ -47,10 +47,10 @@ use Carp;
));
@EXPORT = qw(
);
$VERSION = "0.17";
$VERSION = "0.18";
1;
......@@ -215,7 +215,7 @@ to a list of "start-finish" IP address ranges:
@a=Net::CIDR::cidr2range("10.0.0.0/14", "192.68.0.0/24");
The result is a two-element array:
The result is a two-element array:
("10.0.0.0-10.3.255.255", "192.68.0.0-192.68.0.255").
@a=Net::CIDR::cidr2range("d08c:43::/32");
......@@ -434,7 +434,7 @@ sub _iptoipa {
return ($isipv6, @ips);
}
sub _h62d {
my $h=shift;
......@@ -976,7 +976,7 @@ Example:
@cidr_list=Net::CIDR::range2cidr("192.68.0.0-192.68.0.255");
@cidr_list=Net::CIDR::cidradd("10.0.0.0/8", @cidr_list);
@cidr_list=Net::CIDR::cidradd("192.68.1.0-192.68.1.255", @cidr_list);
The result is a two-element array: ("10.0.0.0/8", "192.68.0.0/23").
IPv6 addresses are handled in an analogous fashion.
......@@ -1282,6 +1282,8 @@ sub cidrvalidate {
$suffix=128 unless defined $suffix;
$v =~ s/([0-9A-Fa-f]+)/_triml0($1)/ge;
foreach (addr2cidr($v))
{
return $_ if $_ eq "$v/$suffix";
......@@ -1289,6 +1291,12 @@ sub cidrvalidate {
return undef;
}
sub _triml0 {
my ($a) = @_;
$a =~ s/^0+//g;
return $a
}
=pod
=head1 BUGS
......
......@@ -43,3 +43,6 @@ Revision history for Perl extension Net::CIDR.
0.17 Sat Oct 20 23:21:18 EDT 2012
- version bump, put META back into the tarball.
0.18 Mon Feb 2 18:12:54 EST 2015
- leading 0s in IPv6 addresses are ok.
......@@ -4,7 +4,7 @@
"Sam Varshavchik <sam@email-scan.com>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120921",
"generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060",
"license" : [
"perl_5"
],
......@@ -37,5 +37,5 @@
}
},
"release_status" : "stable",
"version" : "0.17"
"version" : "0.18"
}
......@@ -3,20 +3,20 @@ abstract: 'Manipulate IPv4/IPv6 netblocks in CIDR notation'
author:
- 'Sam Varshavchik <sam@email-scan.com>'
build_requires:
ExtUtils::MakeMaker: 0
ExtUtils::MakeMaker: '0'
configure_requires:
ExtUtils::MakeMaker: 0
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120921'
generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
version: '1.4'
name: Net-CIDR
no_index:
directory:
- t
- inc
requires:
Carp: 0
version: 0.17
Carp: '0'
version: '0.18'
Summary: Net::CIDR Perl module
Name: perl-Net-CIDR
Version: 0.17
Version: 0.18
Release: 1%(%{__perl} -e 'my $v=$^V; $v =~ s/(.)/".".ord($1)/ge;print "$v\n";')
Source0: Net-CIDR-%{version}.tar.gz
License: Perl
......
......@@ -6,7 +6,7 @@
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
BEGIN { $| = 1; print "1..9\n"; }
BEGIN { $| = 1; print "1..10\n"; }
END {print "not ok 1\n" unless $loaded;}
use Net::CIDR;
$loaded = 1;
......@@ -113,3 +113,11 @@ else
print "not ok 9\n";
}
if (Net::CIDR::cidrvalidate("1:1:000f:01:65:e:1111:eeee"))
{
print "ok 10\n";
}
else
{
print "not ok 10\n";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment