diff --git a/Changes b/Changes index 40f85b3..220a568 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension NetAddr::IP +4.037 Fri Nov 19 10:48:01 PST 2010 + add :upper and :lower to Lite.pm v1.23 + add comments about rfc5952 requirement for lowercase ipV6 notation + in Lite.pm v1.23 and IP.pm + add test for :lower in Lite.pm v1.23 + 4.036 Tue Nov 16 16:28:37 PST 2010 In Util.pm v1.35, naip_gethostbyname modified to return undef instead of 0 (zero) on failure diff --git a/IP.pm b/IP.pm index cd16be3..388ff49 100644 --- a/IP.pm +++ b/IP.pm @@ -4,7 +4,7 @@ use strict; #use diagnostics; -use NetAddr::IP::Lite 1.21 qw(Zero Zeros Ones V4mask V4net); +use NetAddr::IP::Lite 1.23 qw(Zero Zeros Ones V4mask V4net); use NetAddr::IP::Util 1.35 qw( sub128 inet_aton @@ -34,7 +34,7 @@ @ISA = qw(Exporter NetAddr::IP::Lite); -$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.36 $ =~ /\d+/g) }; +$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.37 $ =~ /\d+/g) }; =pod @@ -118,14 +118,24 @@ * By default B functions and methods return string IPv6 addresses in uppercase. To change that to lowercase: +NOTE: the AUGUST 2010 RFC5952 states: + + 4.3. Lowercase + + The characters "a", "b", "c", "d", "e", and "f" in an IPv6 + address MUST be represented in lowercase. + +It is recommended that all NEW applications using NetAddr::IP be +invoked as shown on the next line. + use NetAddr::IP qw(:lower); * To ensure the current IPv6 string case behavior even if the default changes: use NetAddr::IP qw(:upper); -* To set a limit on the size of B processed or returned by -NetAddr::IP. +* To set a limit on the size of B processed or returned by NetAddr::IP. + Set the maximum number of nets beyond which NetAddr::IP will return and error as a power of 2 (default 16 or 65536 nets). Each 2**16 consumes approximately 4 megs of memory. A 2**20 consumes 64 megs of memory, A 2**24 consumes 1 gigabyte of diff --git a/Lite/Changes b/Lite/Changes index aa549bf..5d61d14 100644 --- a/Lite/Changes +++ b/Lite/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension NetAddr::IP::Lite +1.23 Fri Nov 19 10:48:01 PST 2010 + add :upper and :lower to Lite.pm v1.23 + add comments about rfc5952 requirement for lowercase ipV6 notation + add test for :lower + 1.22 Tue Nov 16 16:28:37 PST 2010 update new6 to properly classify short ipv4 notation i.e. 127/8 with test for ":" rather than match for \d.\d.\d.\d diff --git a/Lite/Lite.pm b/Lite/Lite.pm index ab59516..cfcb36b 100644 --- a/Lite/Lite.pm +++ b/Lite/Lite.pm @@ -29,7 +29,7 @@ use vars qw(@ISA @EXPORT_OK $VERSION $Accept_Binary_IP $Old_nth $AUTOLOAD *Zero); -$VERSION = do { my @r = (q$Revision: 1.22 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 1.23 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; require Exporter; @@ -58,6 +58,8 @@ V4net :aton DEPRECATED ! :old_nth + :upper + :lower ); my $ip = new NetAddr::IP::Lite '127.0.0.1'; @@ -108,6 +110,26 @@ operations of NetAddr::IP are supported. This module will work older versions of Perl and does B use Math::BigInt. +* By default B functions and methods return string IPv6 +addresses in uppercase. To change that to lowercase: + +NOTE: the AUGUST 2010 RFC5952 states: + + 4.3. Lowercase + + The characters "a", "b", "c", "d", "e", and "f" in an IPv6 + address MUST be represented in lowercase. + +It is recommended that all NEW applications using NetAddr::IP::Lite be +invoked as shown on the next line. + + use NetAddr::IP::Lite qw(:lower); + +* To ensure the current IPv6 string case behavior even if the default changes: + + use NetAddr::IP::Lite qw(:upper); + + The internal representation of all IP objects is in 128 bit IPv6 notation. IPv4 and IPv6 objects may be freely mixed. @@ -1218,6 +1240,16 @@ $Old_nth = 1; @_ = grep { $_ ne ':old_nth' } @_; } + if (grep { $_ eq ':lower' } @_) + { + NetAddr::IP::Util::lower(); + @_ = grep { $_ ne ':lower' } @_; + } + if (grep { $_ eq ':upper' } @_) + { + NetAddr::IP::Util::upper(); + @_ = grep { $_ ne ':upper' } @_; + } NetAddr::IP::Lite->export_to_level(1, @_); } @@ -1229,6 +1261,8 @@ V4net :aton DEPRECATED :old_nth + :upper + :lower =head1 AUTHOR @@ -1243,7 +1277,7 @@ =head1 LICENSE This software is (c) Luis E. Mu�oz, 1999 - 2005 - and (c) Michael Robinton, 2006 - 2008. + and (c) Michael Robinton, 2006 - 2010. 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 diff --git a/Lite/README b/Lite/README index 3a2956c..b0a821b 100644 --- a/Lite/README +++ b/Lite/README @@ -9,6 +9,8 @@ V4net :aton DEPRECATED ! :old_nth + :upper + :lower ); my $ip = new NetAddr::IP::Lite '127.0.0.1'; @@ -57,6 +59,26 @@ operations of NetAddr::IP are supported. This module will work older versions of Perl and does not use Math::BigInt. + * By default NetAddr::IP functions and methods return string IPv6 + addresses in uppercase. To change that to lowercase: + + NOTE: the AUGUST 2010 RFC5952 states: + + 4.3. Lowercase + + The characters "a", "b", "c", "d", "e", and "f" in an IPv6 + address MUST be represented in lowercase. + + It is recommended that all NEW applications using NetAddr::IP::Lite be + invoked as shown on the next line. + + use NetAddr::IP::Lite qw(:lower); + + * To ensure the current IPv6 string case behavior even if the default + changes: + + use NetAddr::IP::Lite qw(:upper); + The internal representation of all IP objects is in 128 bit IPv6 notation. IPv4 and IPv6 objects may be freely mixed. @@ -395,6 +417,8 @@ V4net :aton DEPRECATED :old_nth + :upper + :lower AUTHOR Luis E. Mu�oz , Michael Robinton @@ -406,7 +430,7 @@ LICENSE This software is (c) Luis E. Mu�oz, 1999 - 2005 - and (c) Michael Robinton, 2006 - 2008. + and (c) Michael Robinton, 2006 - 2010. 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 diff --git a/Lite/t/lower.t b/Lite/t/lower.t new file mode 100644 index 0000000..f4fe92e --- /dev/null +++ b/Lite/t/lower.t @@ -0,0 +1,11 @@ + +#use diagnostics; +use Test::More tests => 2; + +use_ok ('NetAddr::IP::Lite', qw(:lower)); + +my $exp = 'ff:0:0:0:0:0:0:eeaa/128'; +my $ip = new NetAddr::IP::Lite('FF::eeAA'); +my $got = sprintf $ip; +ok ($got eq $exp,"lower case $got"); + diff --git a/MANIFEST b/MANIFEST index 4a7c375..6abfb05 100644 --- a/MANIFEST +++ b/MANIFEST @@ -19,6 +19,7 @@ Lite/t/firstlast.t Lite/t/lemasklen.t Lite/t/loops.t +Lite/t/lower.t Lite/t/mask.t Lite/t/masklen.t Lite/t/netaddr.t diff --git a/META.yml b/META.yml index 2855caf..3c652e5 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: NetAddr-IP -version: 4.036 +version: 4.037 abstract: Manages IPv4 and IPv6 addresses and subnets license: ~ author: