r48980 - in /trunk/libnet-subnets-perl: ./ debian/ examples/ lib/Net/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Dec 19 00:35:18 UTC 2009


Author: jawnsy-guest
Date: Sat Dec 19 00:35:12 2009
New Revision: 48980

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48980
Log:
* New upstream release
* Add myself to Uploaders and Copyright
* Standards-Version 3.8.3 (drop perl version dep)
* Rewrote control description
* Install examples now provided upstream

Added:
    trunk/libnet-subnets-perl/.perltidyrc
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/.perltidyrc
    trunk/libnet-subnets-perl/LICENSE
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/LICENSE
    trunk/libnet-subnets-perl/debian/libnet-subnets-perl.examples
    trunk/libnet-subnets-perl/examples/
      - copied from r48979, branches/upstream/libnet-subnets-perl/current/examples/
    trunk/libnet-subnets-perl/t/01use.t
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/t/01use.t
    trunk/libnet-subnets-perl/t/02pod.t
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/t/02pod.t
    trunk/libnet-subnets-perl/t/03podcoverage.t
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/t/03podcoverage.t
    trunk/libnet-subnets-perl/t/04check.t
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/t/04check.t
    trunk/libnet-subnets-perl/t/05range.t
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/t/05range.t
    trunk/libnet-subnets-perl/t/06list.t
      - copied unchanged from r48979, branches/upstream/libnet-subnets-perl/current/t/06list.t
Removed:
    trunk/libnet-subnets-perl/t/1use.t
    trunk/libnet-subnets-perl/t/2check.t
    trunk/libnet-subnets-perl/t/3range.t
    trunk/libnet-subnets-perl/t/4list.t
Modified:
    trunk/libnet-subnets-perl/Changes
    trunk/libnet-subnets-perl/MANIFEST
    trunk/libnet-subnets-perl/META.yml
    trunk/libnet-subnets-perl/Makefile.PL
    trunk/libnet-subnets-perl/README
    trunk/libnet-subnets-perl/debian/changelog
    trunk/libnet-subnets-perl/debian/control
    trunk/libnet-subnets-perl/debian/rules
    trunk/libnet-subnets-perl/lib/Net/Subnets.pm

Modified: trunk/libnet-subnets-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/Changes?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/Changes (original)
+++ trunk/libnet-subnets-perl/Changes Sat Dec 19 00:35:12 2009
@@ -1,52 +1,43 @@
 Revision history for Perl extension Net::Subnets.
 
-0.21  Sat Feb 19 21:00:00 2005
-        - fixed pod (Jan Harders)
+1.0   2009-12-10 00:00:00
+        - Fixed everything.
 
-0.20  Sun Nov 16 16:00:00 2003
+0.21  2009-02-19 00:00:00
+        - Fixed pod. (Jan Harders)
 
-	- added list() function
-	- better documentation
+0.20  2003-11-16 00:00:00
+        - Added list() function.
+	    - Better documentation.
 
-0.19  Wed Nov 12 11:00:00 2003
+0.19  2003-11-12 00:00:00
+	    - Fixed a bug in subnets() and check() which produced false matches.
+	      (Eric Johanson)
+	    - Fixed the changelog.
 
-	- fixed a bug in subnets() and check() which produced
-	  false matches, reported by Eric Johanson
+0.18  2003-10-13 00:00:00
+	    - Fixed some typos
 
-	- fixed the changelog
+0.17  2003-09-30 00:00:00
+	    - Made the constructor inheritable. (Markus Thielmann)
 
-0.18  Tue Sep 30 21:30:00 2003
+0.16  2003-09-28 00:00:00
+	    - Added range() function.
 
-	- fixed some typos
+0.15  2003-09-15 00:00:00
+        - New test.
 
-0.17  Tue Sep 30 21:00:00 2003
+0.14  2003-09-13 00:00:00
+	    - Better documentation.
 
-	- made the constructor inheritable, reported by Markus Thielmann
+0.13  2003-09-12 00:00:00
+	    - Added example.
 
-0.16  Sun Sep 28 22:00:00 2003
+0.12  2003-09-11 00:00:00
+	    - Fixed even more typos.
 
-	- added range() function
+0.11  2003-09-10 00:00:00
+	    - Fixed some typos.
 
-0.15  Mon Sep 15 21:00:00 2003
-
-	- new test
-
-0.14  Fri Sep 12 23:30:00 2003
-
-	- better documentation
-
-0.13  Fri Sep 12 22:55:00 2003
-
-	- added example
-
-0.12  Fri Sep 12 01:00:00 2003
-
-	- fixed even more typos
-
-0.11  Thu Sep 12 00:00:00 2003
-
-	- fixed some typos
-
-0.10  Wed Aug 27 22:00:00 2003
-
-	- first public release
+0.10  2009-08-28 00:00:00
+	    - first public release

Modified: trunk/libnet-subnets-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/MANIFEST?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/MANIFEST (original)
+++ trunk/libnet-subnets-perl/MANIFEST Sat Dec 19 00:35:12 2009
@@ -1,10 +1,15 @@
+.perltidyrc
 Changes
+examples/matching.pl
 lib/Net/Subnets.pm
+LICENSE
 Makefile.PL
 MANIFEST			This list of files
-META.yml
 README
-t/1use.t
-t/2check.t
-t/3range.t
-t/4list.t
+t/01use.t
+t/02pod.t
+t/03podcoverage.t
+t/04check.t
+t/05range.t
+t/06list.t
+META.yml                                 Module meta-data (added by MakeMaker)

Modified: trunk/libnet-subnets-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/META.yml?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/META.yml (original)
+++ trunk/libnet-subnets-perl/META.yml Sat Dec 19 00:35:12 2009
@@ -1,10 +1,26 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Net-Subnets
-version:      0.21
-version_from: lib/Net/Subnets.pm
-installdirs:  site
+--- #YAML:1.0
+name:               Net-Subnets
+version:            1.0
+abstract:           ~
+author:
+    - Sebastian Riedel (sri at cpan.org)
+license:            artistic_2
+distribution_type:  module
+configure_requires:  {}
+build_requires:  {}
 requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+    ExtUtils::MakeMaker:  0
+    perl:                 5.008001
+    Test::More:           0
+resources:
+    license:     http://dev.perl.org/licenses/
+    repository:  http://github.com/kraih/net-subnets/tree/master
+no_index:
+    directory:
+        - t
+        - inc
+        - t
+generated_by:       ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libnet-subnets-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/Makefile.PL?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/Makefile.PL (original)
+++ trunk/libnet-subnets-perl/Makefile.PL Sat Dec 19 00:35:12 2009
@@ -1,7 +1,40 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2003-2009, Sebastian Riedel.
+
+use strict;
+use warnings;
+
 use ExtUtils::MakeMaker;
 
+my $mm = $ExtUtils::MakeMaker::VERSION;
+
+# Son, when you participate in sporting events,
+# it's not whether you win or lose, it's how drunk you get.
 WriteMakefile(
     NAME         => 'Net::Subnets',
-    AUTHOR       => 'Sebastian Riedel (sri at oook.de)',
+    AUTHOR       => 'Sebastian Riedel (sri at cpan.org)',
     VERSION_FROM => 'lib/Net/Subnets.pm',
+
+    ($mm < 6.3002 ? () : ('LICENSE' => 'artistic_2')),
+
+    (   $mm < 6.46
+        ? ()
+        : ( META_MERGE => {
+                requires  => {perl => '5.008001'},
+                resources => {
+                    license => 'http://dev.perl.org/licenses/',
+                    repository =>
+                      'http://github.com/kraih/net-subnets/tree/master'
+                },
+                no_index => {directory => [qw/t/]}
+            },
+            META_ADD => {
+                build_requires     => {},
+                configure_requires => {}
+            },
+        )
+    ),
+
+    PREREQ_PM => {'ExtUtils::MakeMaker' => 0, 'Test::More' => 0}
 );

Modified: trunk/libnet-subnets-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/README?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/README (original)
+++ trunk/libnet-subnets-perl/README Sat Dec 19 00:35:12 2009
@@ -1,21 +1,8 @@
-Net/Subnets version 0.20
-========================
-
-Very fast matches large lists of IP addresses against many CIDR subnets,
-calculates IP address ranges and provides a simple object oriented interface.
-
-INSTALLATION
+Computing Subnets In Large Scale Networks.
 
 To install this module type the following:
 
-   perl Makefile.PL
-   make
-   make test
-   make install
-
-COPYRIGHT AND LICENCE
-
-Copyright (C) 2003 Sebastian Riedel & Juergen Peters. All rights reserved.
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+    perl Makefile.PL
+    make
+    make test
+    make install

Modified: trunk/libnet-subnets-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/debian/changelog?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/debian/changelog (original)
+++ trunk/libnet-subnets-perl/debian/changelog Sat Dec 19 00:35:12 2009
@@ -1,4 +1,11 @@
-libnet-subnets-perl (0.21-4) UNRELEASED; urgency=low
+libnet-subnets-perl (1.0-1) UNRELEASED; urgency=low
+
+  [ Jonathan Yu ]
+  * New upstream release
+  * Add myself to Uploaders and Copyright
+  * Standards-Version 3.8.3 (drop perl version dep)
+  * Rewrote control description
+  * Install examples now provided upstream
 
   [ gregor herrmann ]
   * debian/watch: use dist-based URL.
@@ -8,7 +15,7 @@
   [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
 
- -- gregor herrmann <gregoa at debian.org>  Wed, 06 Aug 2008 18:23:49 -0300
+ -- Jonathan Yu <jawnsy at cpan.org>  Fri, 18 Dec 2009 16:22:58 -0500
 
 libnet-subnets-perl (0.21-3) unstable; urgency=low
 

Modified: trunk/libnet-subnets-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/debian/control?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/debian/control (original)
+++ trunk/libnet-subnets-perl/debian/control Sat Dec 19 00:35:12 2009
@@ -1,21 +1,22 @@
 Source: libnet-subnets-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 5)
-Build-Depends-Indep: perl (>= 5.8.0)
+Build-Depends: debhelper (>= 7.0.50)
+Build-Depends-Indep: perl, libtest-pod-perl, libtest-pod-coverage-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Ernesto Hernández-Novich (USB) <emhn at usb.ve>
+Uploaders: Ernesto Hernández-Novich (USB) <emhn at usb.ve>,
+ Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.8.3
 Homepage: http://search.cpan.org/dist/Net-Subnets/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnet-subnets-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libnet-subnets-perl/
-Standards-Version: 3.7.3
 
 Package: libnet-subnets-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, 
-Description: A Perl library for subnet calculations
- Net::Subnets provides very fast operations for:
- .
-   - Matching a list of IP addresses against one or more CIDR subnets.
- .
-   - Calculation of IP address ranges.
+Description: module for IPv4 subnet calculations
+ Net::Subnets is a Perl module that provides a quick and simple method to
+ perform miscellaneous operations with IP version 4 (IPv4) addresses. It can
+ match a list of IP addresses against one or more CIDR (Classless Inter-Domain
+ Routing) subnets. It also calculates ranges of IP addresses based on a subnet
+ size, specified as a CIDR.

Added: trunk/libnet-subnets-perl/debian/libnet-subnets-perl.examples
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/debian/libnet-subnets-perl.examples?rev=48980&op=file
==============================================================================
--- trunk/libnet-subnets-perl/debian/libnet-subnets-perl.examples (added)
+++ trunk/libnet-subnets-perl/debian/libnet-subnets-perl.examples Sat Dec 19 00:35:12 2009
@@ -1,0 +1,1 @@
+examples/*

Modified: trunk/libnet-subnets-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/debian/rules?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/debian/rules (original)
+++ trunk/libnet-subnets-perl/debian/rules Sat Dec 19 00:35:12 2009
@@ -1,65 +1,7 @@
 #!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+%:
+	dh $@
 
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PACKAGE=$(shell dh_listpackages)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP     =$(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp:
-	dh_testdir
-	$(PERL) Makefile.PL INSTALLDIRS=vendor
-	$(MAKE)
-	$(MAKE) test
-	touch build-stamp
-
-clean:
-	dh_testdir
-	dh_testroot
-	dh_clean build-stamp install-stamp
-	[ ! -f Makefile ] || $(MAKE) realclean
-
-install: install-stamp
-install-stamp: build-stamp
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-	[ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5
-	touch install-stamp
-
-binary-arch:
-# We have nothing to do by default.
-
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs README
-	dh_installchangelogs Changes
-	dh_perl
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-source diff:                                                                  
-	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+override_dh_auto_test:
+	TEST_POD=1 dh_auto_test

Modified: trunk/libnet-subnets-perl/lib/Net/Subnets.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-subnets-perl/lib/Net/Subnets.pm?rev=48980&op=diff
==============================================================================
--- trunk/libnet-subnets-perl/lib/Net/Subnets.pm (original)
+++ trunk/libnet-subnets-perl/lib/Net/Subnets.pm Sat Dec 19 00:35:12 2009
@@ -1,68 +1,64 @@
+# Copyright (C) 2003-2009, Sebastian Riedel.
+
 package Net::Subnets;
 
 use strict;
-use vars qw($VERSION);
+use vars qw/$VERSION/;
 
-$VERSION = '0.21';
+$VERSION = '1.0';
 
 sub new {
     my $self = shift;
-    return bless( {}, ( ref($self) || $self ) );
+    return bless({}, (ref($self) || $self));
 }
 
 sub subnets {
-    my ( $self, $subnets ) = @_;
+    my ($self, $subnets) = @_;
     my %masks;
     foreach (@$subnets) {
         /^(.+?)\/(.+)$/o;
-        my $revmask = 32 - ( $2 || 32 );
+        my $revmask = 32 - ($2 || 32);
         $self->{subnets}{$revmask}
-          { unpack( "N", pack( "C4", split( /\./, $1 ) ) ) >> $revmask } = $_;
+          {unpack("N", pack("C4", split(/\./, $1))) >> $revmask} = $_;
         $masks{$revmask}++;
     }
-    @{ $self->{masks} } =
-      sort( { $masks{$a} <=> $masks{$b} } keys(%masks) );
+    @{$self->{masks}} =
+      sort({$masks{$a} <=> $masks{$b}} keys(%masks));
 }
 
 sub check {
-    my ( $self, $address ) = @_;
-    foreach ( @{ $self->{masks} } ) {
-        my $option =
-          unpack( "N", pack( "C4", split( /\./, $$address ) ) ) >> $_;
-        if ( $self->{subnets}{$_}{$option} ) {
-            return \( $self->{subnets}{$_}{$option} );
+    my ($self, $address) = @_;
+    foreach (@{$self->{masks}}) {
+        my $option = unpack("N", pack("C4", split(/\./, $$address))) >> $_;
+        if ($self->{subnets}{$_}{$option}) {
+            return \($self->{subnets}{$_}{$option});
         }
     }
     return 0;
 }
 
 sub range {
-    my ( $self, $subnet ) = @_;
+    my ($self, $subnet) = @_;
     $$subnet =~ /^(.+?)\/(.+)$/o;
     my $net =
-      pack( 'C4', split( /\./, $1 ) ) &
-      pack( 'B*', ( 1 x $2 ) . ( 0 x ( 32 - ( $2 || 32 ) ) ) );
-    my $lowip =
-      join( '.', unpack( 'C4', pack( 'B*', ( 0 x 31 ) . 1 ) | $net ) );
-    my $highip = join(
-        '.',
-        unpack(
-            'C4', pack( 'B*', ( 0 x $2 ) . ( 1 x ( 31 - $2 ) ) . 0 ) | $net
-        )
-    );
-    if ( $2 == 32 ) {
-        return ( \$highip, \$highip );
+      pack('C4', split(/\./, $1))
+      & pack('B*', (1 x $2) . (0 x (32 - ($2 || 32))));
+    my $lowip = join('.', unpack('C4', pack('B*', (0 x 31) . 1) | $net));
+    my $highip = join('.',
+        unpack('C4', pack('B*', (0 x $2) . (1 x (31 - $2)) . 0) | $net));
+    if ($2 == 32) {
+        return (\$highip, \$highip);
     }
-    return ( \$lowip, \$highip );
+    return (\$lowip, \$highip);
 }
 
 sub list {
-    my ( $self, $lowip, $highip ) = @_;
-    my $lowint  = unpack( "N", pack( "C4", split( /\./, $$lowip ) ) );
-    my $highint = unpack( "N", pack( "C4", split( /\./, $$highip ) ) );
-    my @list = ( join( '.', unpack( 'C4', pack( 'N', $lowint ) ) ) );
-    while ( $lowint lt $highint ) {
-        push( @list, join( '.', unpack( 'C4', pack( 'N', ++$lowint ) ) ) );
+    my ($self, $lowip, $highip) = @_;
+    my $lowint  = unpack("N", pack("C4", split(/\./, $$lowip)));
+    my $highint = unpack("N", pack("C4", split(/\./, $$highip)));
+    my @list = (join('.', unpack('C4', pack('N', $lowint))));
+    while ($lowint lt $highint) {
+        push(@list, join('.', unpack('C4', pack('N', ++$lowint))));
     }
     return \@list;
 }
@@ -72,71 +68,43 @@
 
 =head1 NAME
 
-Net::Subnets - Computing subnets in large scale networks
+Net::Subnets - Computing Subnets In Large Scale Networks
 
 =head1 SYNOPSIS
 
     use Net::Subnets;
     my $sn = Net::Subnets->new;
-    $sn->subnets( \@subnets );
-    if ( my $subnetref = $sn->check( \$address ) ) {
+    $sn->subnets(\@subnets);
+    if (my $subnetref = $sn->check(\$address)) {
         ...
     }
-    my ( $lowipref, highipref ) = $sn->range( \$subnet );
-    my $listref = $sn->list( \( $lowipref, $highipref ) );
+    my ($lowipref, highipref) = $sn->range(\$subnet);
+    my $listref = $sn->list(\($lowipref, $highipref));
 
 =head1 DESCRIPTION
 
 Very fast matches large lists of IP addresses against many CIDR subnets and
 calculates IP address ranges.
 
-The following functions are provided by this module:
-
-    new()
-        Creates an "Net::Subnets" object.
-        It takes no arguments.
-
-    subnets( \@subnets )
-        The subnets() function lets you prepare a list of CIDR subnets.
-        It takes an array reference.
-
-    check( \$address )
-        The check() function lets you check an IP address against the
-        previously prepared subnets.
-        It takes a scalar reference and returns a scalar reference to
-        the first matching CIDR subnet.
-
-    range( \$subnet )
-        The range() function lets you calculate the IP address range
-        of a subnet.
-        It takes a scalar reference and returns two scalar references to
-        the lowest and highest IP address.
-
-    list( \$lowip, \$highip )
-        The list() function lets you calculate a list containing all IP
-        addresses in a given range.
-        It takes two scalar references and returns a reference to a list
-        containing the IP addresses.
-
 This is a simple and efficient example for subnet matching:
 
     use Net::Subnets;
 
     my @subnets   = qw(10.0.0.0/24 10.0.1.0/24);
-    my @addresses = qw(10.0.0.1 10.0.1.2 10.0.3.1);
+    my @addresses = qw/10.0.0.1 10.0.1.2 10.0.3.1/;
 
     my $sn = Net::Subnets->new;
-    $sn->subnets( \@subnets );
+    $sn->subnets(\@subnets);
     my $results;
-    foreach my $address ( @addresses ) {
-        if ( my $subnetref = $sn->check( \$address ) ) {
+    foreach my $address (@addresses) {
+        if (my $subnetref = $sn->check(\$address)) {
             $results .= "$address: $$subnetref\n";
         }
         else {
             $results .= "$address: not found\n";
         }
     }
-    print( $results );
+    print($results);
 
 This is a simple example for range calculation:
 
@@ -146,8 +114,8 @@
 
     my $sn = Net::Subnets->new;
     my $results;
-    foreach my $subnet ( @subnets ) {
-        my ( $lowipref, $highipref ) = $sn->range( \$subnet );
+    foreach my $subnet (@subnets) {
+        my ($lowipref, $highipref) = $sn->range(\$subnet);
         $results .= "$subnet: $$lowipref - $$highipref\n";
     }
     print( $results );
@@ -160,23 +128,55 @@
     my $highip = '192.168.0.100';
 
     my $sn = Net::Subnets->new;
-    my $listref = $sn->list( \( $lowip, $highip ) );
-    foreach my $address ( @{ $listref } ) {
+    my $listref = $sn->list(\($lowip, $highip));
+    foreach my $address (@$listref) {
         # do something cool
     }
 
+=head1 METHODS
+
+=head2 C<new>
+
+    my $subnets = Net::Subnets->new;
+
+    Creates an "Net::Subnets" object.
+
+=head2 C<subnets>
+
+    $subnets->subnets([qw(10.0.0.0/24 10.0.1.0/24)]);
+
+    The C<subnets> method lets you prepare a list of CIDR subnets.
+
+=head2 C<check>
+
+    my $match = $subnets->check(\$address);
+
+    The C<check> method lets you check an IP address against the previously
+    prepared subnets.
+
+=head2 C<range>
+
+    my ($lowest, $highest) = $subnets->range(\$subnet)
+
+    The C<range> method lets you calculate the IP address range of a subnet.
+
+=head2 C<list>
+
+    my $list = $subnets->list(\$lowest, $highest);
+
+    The C<list> method lets you calculate a list containing all IP addresses
+    in a given range.
 
 =head1 AUTHOR
 
 Sebastian Riedel (sri at cpan.org),
 Juergen Peters (juergen.peters at taulmarill.de)
 
-=head1 COPYRIGHT
+=head1 COPYRIGHT AND LICENSE
 
-Copyright 2003 Sebastian Riedel & Juergen Peters. All rights reserved.
+Copyright (C) 2003-2009, Sebastian Riedel.
 
-This library is free software. You can redistribute it and/or
-modify it under the same terms
-as perl itself.
+This program is free software, you can redistribute it and/or modify it under
+the terms of the Artistic License version 2.0.
 
 =cut




More information about the Pkg-perl-cvs-commits mailing list