r2415 - in packages/libnet-cidr-lite-perl/trunk: . debian
Niko Tyni
ntyni-guest at costa.debian.org
Fri Mar 17 22:24:17 UTC 2006
Author: ntyni-guest
Date: 2006-03-17 22:24:17 +0000 (Fri, 17 Mar 2006)
New Revision: 2415
Added:
packages/libnet-cidr-lite-perl/trunk/META.yml
packages/libnet-cidr-lite-perl/trunk/t/
Removed:
packages/libnet-cidr-lite-perl/trunk/test.pl
Modified:
packages/libnet-cidr-lite-perl/trunk/Changes
packages/libnet-cidr-lite-perl/trunk/Lite.pm
packages/libnet-cidr-lite-perl/trunk/MANIFEST
packages/libnet-cidr-lite-perl/trunk/README
packages/libnet-cidr-lite-perl/trunk/debian/changelog
packages/libnet-cidr-lite-perl/trunk/debian/control
Log:
Adopted; new upstream release.
Modified: packages/libnet-cidr-lite-perl/trunk/Changes
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/Changes 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/Changes 2006-03-17 22:24:17 UTC (rev 2415)
@@ -1,5 +1,18 @@
Revision history for Perl extension Net::CIDR::Lite.
+0.20 Sun Feb 12 01:00:00 2006
+ - Fix error message on mask values.
+0.19 Sat Jan 30 01:00:00 2006
+ - Allow net mask of zero.
+0.18 Sat May 20 01:00:00 2005
+ - Documented bin_find().
+ - Added pod tests. Watch my kwalitee go up! Woohoo!
+0.17 Wed May 18 12:00:00 2005
+ - Fixed last fix and corresponding test.
+0.16 Wed May 18 10:00:00 2005
+ - Fixed divide by zero on find with empty spanner.
+ Reported by jgmyers via rt.cpan.org.
+ - Fixed pod errors.
0.15 Wed Apr 16 13:00:00 2003
- Fixed # of tests in test.pl. Thanks to CPAN testers.
- Squelched '-w' warning about doubly declared lexical variable.
Modified: packages/libnet-cidr-lite-perl/trunk/Lite.pm
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/Lite.pm 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/Lite.pm 2006-03-17 22:24:17 UTC (rev 2415)
@@ -4,7 +4,7 @@
use vars qw($VERSION);
use Carp qw(confess);
-$VERSION = '0.15';
+$VERSION = '0.20';
my %masks;
my @fields = qw(PACK UNPACK NBITS MASKS);
@@ -37,7 +37,7 @@
my ($ip, $mask) = split "/", shift;
$self->_init($ip) || confess "Can't determine ip format" unless %$self;
confess "Bad mask $mask"
- unless $mask =~ /^\d+$/ and 2 <= $mask and $mask <= $self->{NBITS};
+ unless $mask =~ /^\d+$/ and $mask <= $self->{NBITS}-8;
$mask += 8;
my $start = $self->{PACK}->($ip) & $self->{MASKS}[$mask]
or confess "Bad ip address: $ip";
@@ -294,12 +294,12 @@
Net::CIDR::Lite::Span->new(@_);
}
-sub ranges {
+sub _ranges {
sort keys %{shift->{RANGES}};
}
-sub packer { shift->{PACK} }
-sub unpacker { shift->{UNPACK} }
+sub _packer { shift->{PACK} }
+sub _unpacker { shift->{UNPACK} }
package Net::CIDR::Lite::Span;
use Carp qw(confess);
@@ -315,14 +315,14 @@
my $self = shift;
my $ranges = $self->{RANGES};
if (@_ && !$self->{PACK}) {
- $self->{PACK} = $_[0]->packer;
- $self->{UNPACK} = $_[0]->unpacker;
+ $self->{PACK} = $_[0]->_packer;
+ $self->{UNPACK} = $_[0]->_unpacker;
}
while (@_) {
my ($cidr, $label) = (shift, shift);
$cidr = Net::CIDR::Lite->new($cidr) unless ref($cidr);
$cidr->clean;
- for my $ip ($cidr->ranges) {
+ for my $ip ($cidr->_ranges) {
push @{$ranges->{$ip}}, $label;
}
}
@@ -337,6 +337,7 @@
my $in_range;
$self->prep_find unless $self->{FIND};
return {} unless @_;
+ return { map { $_ => {} } @_ } unless @{$self->{FIND}};
return $self->bin_find(@_) if @_/@{$self->{FIND}} < $self->{PCT};
my @ips = sort map { $pack->($_) || confess "Bad IP: $_" } @_;
my $last;
@@ -359,6 +360,7 @@
my $self = shift;
return {} unless @_;
$self->prep_find unless $self->{FIND};
+ return { map { $_ => {} } @_ } unless @{$self->{FIND}};
my $pack = $self->{PACK};
my $unpack = $self->{UNPACK};
my $find = $self->{FIND};
@@ -438,6 +440,8 @@
=head1 METHODS
+=over 4
+
=item new()
$cidr = Net::CIDR::Lite->new
@@ -518,6 +522,10 @@
but if more addresses are added to the cidr object, prep_find() must
be called on the cidr object.
+=item $cidr->bin_find()
+
+Same as find(), but forces a binary search. See also prep_find.
+
=item $cidr->prep_find()
$cidr->prep_find($num);
@@ -550,9 +558,13 @@
$href = $spanner->find(@ip_addresses);
Look up which range(s) ip addresses are in, and return a lookup table
-of the results, with the keys being the ip addresses, and the value an
+of the results, with the keys being the ip addresses, and the value a
hash reference of which address ranges the ip address is in.
+=item $spanner->bin_find()
+
+Same as find(), but forces a binary search. See also prep_find.
+
=item $spanner->prep_find()
$spanner->prep_find($num);
@@ -572,6 +584,8 @@
unnecessary leading zeros, removes null blocks from IPv6
addresses, etc.
+=back
+
=head1 CAVEATS
Garbage in/garbage out. This module does do validation, but maybe
Modified: packages/libnet-cidr-lite-perl/trunk/MANIFEST
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/MANIFEST 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/MANIFEST 2006-03-17 22:24:17 UTC (rev 2415)
@@ -2,5 +2,8 @@
Lite.pm
Makefile.PL
MANIFEST
+META.yml
README
-test.pl
+t/base.t
+t/pod.t
+t/podcov.t
Copied: packages/libnet-cidr-lite-perl/trunk/META.yml (from rev 2414, packages/libnet-cidr-lite-perl/branches/upstream/current/META.yml)
Modified: packages/libnet-cidr-lite-perl/trunk/README
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/README 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/README 2006-03-17 22:24:17 UTC (rev 2415)
@@ -10,7 +10,7 @@
make test
make install
-See tests (in the test.pl file) for an example.
+See tests (in the test.pl file) for examples.
COPYRIGHT AND LICENCE
Modified: packages/libnet-cidr-lite-perl/trunk/debian/changelog
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/debian/changelog 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/debian/changelog 2006-03-17 22:24:17 UTC (rev 2415)
@@ -1,3 +1,10 @@
+libnet-cidr-lite-perl (0.20-1) unstable; urgency=low
+
+ * New upstream release. (Closes: #329599)
+ * Adopted for the Debian Perl Group. (Closes: #357086)
+
+ -- Niko Tyni <ntyni at iki.fi> Sat, 18 Mar 2006 00:21:53 +0200
+
libnet-cidr-lite-perl (0.15-1) unstable; urgency=low
* Initial Release.
Modified: packages/libnet-cidr-lite-perl/trunk/debian/control
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/debian/control 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/debian/control 2006-03-17 22:24:17 UTC (rev 2415)
@@ -3,7 +3,8 @@
Priority: optional
Build-Depends: debhelper (>= 4.0.2)
Build-Depends-Indep: perl (>= 5.8.0-7)
-Maintainer: Chip Salzenberg <chip at debian.org>
+Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
+Uploaders: Niko Tyni <ntyni at iki.fi>
Standards-Version: 3.6.1
Package: libnet-cidr-lite-perl
Copied: packages/libnet-cidr-lite-perl/trunk/t (from rev 2414, packages/libnet-cidr-lite-perl/branches/upstream/current/t)
Deleted: packages/libnet-cidr-lite-perl/trunk/test.pl
===================================================================
--- packages/libnet-cidr-lite-perl/trunk/test.pl 2006-03-17 22:21:47 UTC (rev 2414)
+++ packages/libnet-cidr-lite-perl/trunk/test.pl 2006-03-17 22:24:17 UTC (rev 2415)
@@ -1,94 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-#########################
-
-# change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test;
-use strict;
-$|++;
-BEGIN { plan tests => 28 };
-use Net::CIDR::Lite;
-ok(1); # If we made it this far, we're ok.
-
-#########################
-
-# Insert your test code below, the Test module is use()ed here so read
-# its man page ( perldoc Test ) for help writing this test script.
-
-my $cidr = Net::CIDR::Lite->new;
-
-$cidr->add("209.152.214.112/30");
-$cidr->add("209.152.214.116/31");
-$cidr->add("209.152.214.118/31");
-
-my @list = $cidr->list;
-ok(scalar(@list), 1);
-ok($list[0], "209.152.214.112/29");
-
-ok($cidr->find('209.152.214.112'));
-ok($cidr->find('209.152.214.114'));
-ok(! $cidr->find('209.152.214.111'));
-ok(! $cidr->find('209.152.214.120'));
-ok($cidr->bin_find('209.152.214.114'));
-ok(! $cidr->bin_find('209.152.214.111'));
-ok(! $cidr->bin_find('209.152.214.120'));
-
-my $cidr6 = Net::CIDR::Lite->new;
-
-$cidr6->add("dead:beef:0000:0000:0000:0000:0000:0000/128");
-$cidr6->add("dead:beef:0000:0000:0000:0000:0000:0001/128");
-my @list6 = $cidr6->list;
-ok(scalar(@list6), 1);
-ok($list6[0], "dead:beef::/127");
-
-my $cidr6a = Net::CIDR::Lite->new;
-$cidr6a->add("dead:beef:0000:0000:0000:0000:0000:0002/127");
-$cidr6a->add("dead:beef:0000:0000:0000:0000:0000:0004/127");
-my @list6a = $cidr6a->list;
-ok(scalar(@list6a), 2);
-ok($list6a[0], "dead:beef::2/127");
-ok($list6a[1], "dead:beef::4/127");
-
-my $spanner = $cidr->spanner('HAL');
-ok($spanner);
-my @ips = qw(209.152.214.111 209.152.214.113);
-my $lkup = $spanner->find(@ips);
-ok(exists $lkup->{$ips[1]}{HAL});
-ok(scalar(keys %{$lkup->{$ips[1]}}), 1);
-
-# Add a new ip and make sure its in all ranges
-my $new_ip = '209.152.214.114';
-$spanner->add($new_ip,'label');
-$spanner->prep_find;
-$lkup = $spanner->find($new_ip);
-ok($lkup->{$new_ip}{HAL});
-ok($lkup->{$new_ip}{label});
-
-# Force a binary find and make sure it all still works
-$spanner->prep_find(50);
-$lkup = $spanner->find($new_ip);
-ok($lkup->{$new_ip}{HAL});
-ok($lkup->{$new_ip}{label});
-
-# Make sure 0.0.0.0 works
-my $zero = Net::CIDR::Lite->new("0.0.0.0/8");
-my @zero = $zero->list;
-ok($zero[0] eq "0.0.0.0/8");
-
-# Make sure list range works
-my $cidr_tlist = Net::CIDR::Lite->new("156.147.0.0/16");
-my @range = $cidr_tlist->list_range;
-ok(scalar(@range), 1);
-ok($range[0], "156.147.0.0-156.147.255.255");
-
-# Test find in beginning of range
-my $cidr_find =
- Net::CIDR::Lite->new('218.48.0.0/13','218.144.0.0/12','218.232.0.0/15');
-
-ok($cidr_find->bin_find('218.144.0.0'));
-
-my @list_zero = Net::CIDR::Lite->new('0.0.0.0/32')->list_range;
-ok(scalar(@list_zero), 1);
-ok($list_zero[0], '0.0.0.0-0.0.0.0');
More information about the Pkg-perl-cvs-commits
mailing list