diff --git a/IP.pm b/IP.pm index 9f0dacd..df09efc 100644 --- a/IP.pm +++ b/IP.pm @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# $Id: IP.pm,v 3.28 2005/09/28 23:56:52 lem Exp $ +# $Id: IP.pm,v 3.32 2006/05/01 17:11:18 lem Exp $ package NetAddr::IP; @@ -48,7 +48,7 @@ our @ISA = qw(Exporter); -our $VERSION = do { sprintf " %d.%03d", (q$Revision: 3.28 $ =~ /\d+/g) }; +our $VERSION = do { sprintf "%d.%02d", (q$Revision: 3.32 $ =~ /\d+/g) }; # Set to true, to enable recognizing of 4-octet binary notation IP # addresses. Thanks to Steve Snodgrass for reporting. This can be done @@ -721,15 +721,6 @@ return if vec($mask, $_, 8) < vec($mask, $_ + 1, 8); } } - elsif (($a = gethostbyname($ip)) and defined($a) - and ($a ne pack("C4", 0, 0, 0, 0))) { - if ($a and inet_ntoa($a) =~ m!^(\d+)\.(\d+)\.(\d+)\.(\d+)$!) { - vec($addr, 0, 8) = $1; - vec($addr, 1, 8) = $2; - vec($addr, 2, 8) = $3; - vec($addr, 3, 8) = $4; - } - } elsif ($Accept_Binary_IP and !$present and length($ip) == 4) { my @o = unpack("C4", $ip); @@ -747,6 +738,15 @@ vec($addr, 0, 8) = 127; vec($addr, 3, 8) = 1; } + elsif (($a = gethostbyname($ip)) and defined($a) + and ($a ne pack("C4", 0, 0, 0, 0))) { + if ($a and inet_ntoa($a) =~ m!^(\d+)\.(\d+)\.(\d+)\.(\d+)$!) { + vec($addr, 0, 8) = $1; + vec($addr, 1, 8) = $2; + vec($addr, 2, 8) = $3; + vec($addr, 3, 8) = $4; + } + } else { # croak "Cannot obtain an IP address out of $ip"; return; @@ -1814,7 +1814,7 @@ =head1 HISTORY -$Id: IP.pm,v 3.28 2005/09/28 23:56:52 lem Exp $ +$Id: IP.pm,v 3.32 2006/05/01 17:11:18 lem Exp $ =over @@ -2426,13 +2426,26 @@ =back $Log: IP.pm,v $ +Revision 3.32 2006/05/01 17:11:18 lem +Force update as upload failed + +Revision 3.31 2006/05/01 16:47:15 lem +Fixed CPAN #16754, version contained a space + +Revision 3.30 2006/05/01 15:31:19 lem +Moved DNS resolution to the last spot in the chain, before special +keywords, as suggested by Kevin Brintnall - Thanks! + +Revision 3.29 2005/10/05 18:01:30 lem +Change version digits back to previous levels + Revision 3.28 2005/09/28 23:56:52 lem Each revision will now add the CVS log to the docs automatically. =head1 AUTHOR -Luis E. Mu�oz +Luis E. Muñoz =head1 WARRANTY @@ -2441,7 +2454,7 @@ =head1 LICENSE -This software is (c) Luis E. Mu�oz. It can be used under the terms of +This software is (c) Luis E. Muñoz. It can be used under the terms of the perl artistic license provided that proper credit for the work of the author is preserved in the form of this copyright notice and license for this module. diff --git a/META.yml b/META.yml index 0d7ddc4..2c453a9 100644 --- a/META.yml +++ b/META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: NetAddr-IP -version: 3.028 +version: 3.32 version_from: IP.pm installdirs: site requires: diff --git a/README b/README index 6e5f31d..b491adb 100644 --- a/README +++ b/README @@ -4,6 +4,7 @@ + NetAddr::IP - Manages IP addresses and subnets * * * * THIS MODULE REQUIRES PERL 5.6.0 OR NEWER. * * * * @@ -124,6 +125,14 @@ Report your bugs to me (luismunoz@cpan.org). +DO YOU WANT TO THANK ME? + +If you consider this a valuable contribution, there is a web page +where you can express your gratitude. Please see + + http://mipagina.cantv.net/lem/thanks-en.html (English) + http://mipagina.cantv.net/lem/thanks-es.html (Spanish) + SECURITY CONSIDERATIONS I have no control on the machanisms involved in the storage or @@ -152,7 +161,7 @@ LICENSE AND WARRANTY -This software is (c) Luis E. Mu�oz. It can be used under the terms of +This software is (c) Luis E. Muñoz. It can be used under the terms of the perl artistic license provided that proper credit for the work of the author is preserved in the form of this copyright notice and license for this module. @@ -162,7 +171,7 @@ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (Darwin) -iD8DBQFCQwzJQyDWGRI/hhARAqd9AJ0XLAPEZ/r0laqAs4XhZ26xf00OAQCgzYxk -IjdkSW+uHhcUXN6nJlo7yqA= -=9Ztj +iD8DBQFEVjDeQyDWGRI/hhARAk+FAJ9hlpLFuGsJiGLqPzEA/jO+lCkoSACgjsMV +arBrKLqsAmyuUGm+JXA1rn0= +=6Doe -----END PGP SIGNATURE----- diff --git a/SIGNATURE b/SIGNATURE index 3b29560..cc8ef85 100644 --- a/SIGNATURE +++ b/SIGNATURE @@ -14,15 +14,15 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -SHA1 e0b6dbf9a16123a2a08cff156e61c5d462ce5a72 IP.pm +SHA1 d418fed3d33925e002411a2d36c1174d27704749 IP.pm SHA1 6433ee417d2773d717542beda307a4b769f23445 MANIFEST SHA1 30074c1a88a1ac469ce2bab6104ee099d334d466 MANIFEST.SKIP SHA1 15b06e5353ff05dd2fa881d5eb92e0a4a9457e67 META.yml SHA1 7ff7c25206c71b0b8e16f782d33279a67ef0a6a3 Makefile.PL -SHA1 e0a622d5dfe578b0344b824b27f9c0a46f029250 README -SHA1 a3c3e184556159978520c47b7837c26efa453b29 TODO +SHA1 15f79045eb6bf6b0d4b35f4ca0468340f5e57a15 README +SHA1 834b38162820d64484b5c8f3e601962e60742ff6 TODO SHA1 2bf2f62cb765b20126756819844b45cbe5f89979 t/00-Sign.t -SHA1 af1b413170c28b1482cd21650934180cfed318b9 t/00-load.t +SHA1 ea1ba2a8137b5912f060a053a981d73ea300f73f t/00-load.t SHA1 647ad43b533838cfcacfd85af3c2176d9de9dc20 t/bitops.t SHA1 408e29a1b1ded7a1f42501c3e0843a1b07ac01c1 t/imhoff.t SHA1 ad8be2dc7d91acd0ab1e637f3032ff0175b879b1 t/loops.t @@ -66,7 +66,7 @@ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (Darwin) -iD8DBQFDQX4dQyDWGRI/hhARAlh0AJ41GcRipaB+vMzfOZFhQ8K1nNAVdQCgm6kA -6zO0CdQKybXauQJlzc14/do= -=57Tl +iD8DBQFEVj4TQyDWGRI/hhARAr86AJ9pi5rGbrZ2s52Z43yiDEkynHSydACeK0u7 +ABWPf7iltCldgXsPY11webA= +=CoX8 -----END PGP SIGNATURE----- diff --git a/TODO b/TODO index 4249d7c..cf268bf 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ -$Id: TODO,v 1.6 2005/03/24 20:41:51 lem Exp $ +$Id: TODO,v 1.7 2006/05/01 16:55:18 lem Exp $ o More tests for IPv6 functionality. This should be thoroughly tested. @@ -10,3 +10,13 @@ o Add a way to force the recognition of a v6 IP address when the input is presented numerically. (Suggested by Carlos Vicente) +o As suggested by Geoff Seeley's application, it may be good to have a + method that will convert an arbitrary IP range into a list of + subnets (a list of NetAddr::IP objects) + +o Add simple is_broadcast and is_network utility functions + +o Have foreach iteration of NetAddr::IP return objects based in the + specified netmask instead of forcing /32s, as suggested by Steve + Thompson + diff --git a/t/00-load.t b/t/00-load.t index 3e2ea27..f11c7d2 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -1,6 +1,6 @@ # Generic load/POD test suite -# $Id: 00-load.t,v 1.5 2005/08/25 15:35:47 lem Exp $ +# $Id: 00-load.t,v 1.6 2006/05/01 15:24:50 lem Exp $ use Test::More; @@ -18,11 +18,11 @@ my $coverage = 0; eval { require Test::Pod; - Test::Pod::import(); + Test::Pod::import(); $checker = 1; }; eval { require Pod::Coverage; - Pod::Coverage::import(); + Pod::Coverage::import(); $coverage = 1; }; for my $m (@modules) @@ -36,31 +36,32 @@ skip "Test::Pod is not available on this host", scalar @paths unless $checker; pod_file_ok($_) for @paths; +} - skip "Pod::Coverage is not available on this host", scalar @paths +SKIP: { skip "Pod::Coverage is not available on this host", scalar @paths unless $coverage; - for my $m (@modules) - { - my $pc = Pod::Coverage->new(package => $m, - also_private => [qr/^STORABLE_/, - qr/^new4$/, - qr/^expand_v6$/, - qr/^do_prefix$/, - ], - trustme => [ qr/^Coalesce$|^Compact$/, - qr/^(plus){1,2}$/, - qr/^(minus){1,2}$/ - ], - ); - unless (is($pc->coverage, 1, "Coverage for $m")) + for my $m (@modules) { + my $pc = Pod::Coverage->new(package => $m, + also_private => [qr/^STORABLE_/, + qr/^new4$/, + qr/^expand_v6$/, + qr/^do_prefix$/, + ], + trustme => [ qr/^Coalesce$|^Compact$/, + qr/^(plus){1,2}$/, + qr/^(minus){1,2}$/ + ], + ); + unless (is($pc->coverage, 1, "Coverage for $m")) + { # diag "Symbols covered:\n", # join("\n", map { " " . $_ } $pc->covered); - diag "Symbols NOT covered:\n", - join("\n", map { " " . $_ } $pc->naked); + diag "Symbols NOT covered:\n", + join("\n", map { " " . $_ } $pc->naked); + } } - } -} + }