r66713 - in /trunk/libnet-mac-perl: Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README debian/changelog examples/ inc/ lib/Net/MAC.pm t/10_convert_args.t t/20_custom_format.t t/Net-MAC.t t/bulk10.t t/bulk16.t

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Fri Dec 31 13:54:24 UTC 2010


Author: periapt-guest
Date: Fri Dec 31 13:54:16 2010
New Revision: 66713

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66713
Log:
New upstream release

Added:
    trunk/libnet-mac-perl/LICENSE
      - copied unchanged from r66712, branches/upstream/libnet-mac-perl/current/LICENSE
    trunk/libnet-mac-perl/META.json
      - copied unchanged from r66712, branches/upstream/libnet-mac-perl/current/META.json
    trunk/libnet-mac-perl/examples/
      - copied from r66712, branches/upstream/libnet-mac-perl/current/examples/
    trunk/libnet-mac-perl/t/20_custom_format.t
      - copied unchanged from r66712, branches/upstream/libnet-mac-perl/current/t/20_custom_format.t
Removed:
    trunk/libnet-mac-perl/INSTALL
    trunk/libnet-mac-perl/inc/
Modified:
    trunk/libnet-mac-perl/Changes
    trunk/libnet-mac-perl/MANIFEST
    trunk/libnet-mac-perl/META.yml
    trunk/libnet-mac-perl/Makefile.PL
    trunk/libnet-mac-perl/README
    trunk/libnet-mac-perl/debian/changelog
    trunk/libnet-mac-perl/lib/Net/MAC.pm
    trunk/libnet-mac-perl/t/10_convert_args.t
    trunk/libnet-mac-perl/t/Net-MAC.t
    trunk/libnet-mac-perl/t/bulk10.t
    trunk/libnet-mac-perl/t/bulk16.t

Modified: trunk/libnet-mac-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/Changes?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/Changes (original)
+++ trunk/libnet-mac-perl/Changes Fri Dec 31 13:54:16 2010
@@ -1,4 +1,18 @@
-# This file documents the revision history for Perl extension Net::MAC.
+2.103622  2010-12-28 21:00:37 Europe/London
+
+        - Fix for converting between two as_ formats,
+            the delimiter discovery is a bit more relaxed
+
+2.103621  2010-12-28 14:36:42 Europe/London
+
+        - Add custom format support (rt.cpan #63017)
+
+1.103620  2010-12-28 12:55:41 Europe/London
+
+        - Port to Dist::Zilla
+
+1.6     2010-06-02 10:49 GMT
+        - Fix test for changes to Test::Simple (RT.cpan#57867)
 
 1.5     2008-11-08 17:42 GMT
         - Move to Module::Install

Modified: trunk/libnet-mac-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/MANIFEST?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/MANIFEST (original)
+++ trunk/libnet-mac-perl/MANIFEST Fri Dec 31 13:54:16 2010
@@ -1,23 +1,18 @@
 Changes
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
-INSTALL
+LICENSE
+MANIFEST
+META.json
+META.yml
+Makefile.PL
+README
+examples/gen_macs.pl
 lib/Net/MAC.pm
-Makefile.PL
-MANIFEST			This list of files
-META.yml
-README
 t/100_base10_macs.pl
 t/100_base16_macs.pl
 t/10_convert_args.t
+t/20_custom_format.t
+t/Net-MAC.t
 t/bulk10.t
 t/bulk16.t
-t/Net-MAC.t
 t/pod-coverage.t
 t/pod.t

Modified: trunk/libnet-mac-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/META.yml?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/META.yml (original)
+++ trunk/libnet-mac-perl/META.yml Fri Dec 31 13:54:16 2010
@@ -4,19 +4,22 @@
   - 'Karl Ward <karlward at cpan.org>'
 build_requires:
   Test::More: 0
-  Test::Pod: 0
-  Test::Pod::Coverage: 0
-distribution_type: module
-generated_by: 'Module::Install version 0.77'
+configure_requires:
+  ExtUtils::MakeMaker: 6.31
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400'
 license: gpl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   version: 1.4
 name: Net-MAC
-no_index:
-  directory:
-    - inc
-    - t
 requires:
-  perl: 5.8.1
-version: 1.5
+  Carp: 0
+  integer: 0
+  overload: 0
+  perl: 5.006000
+resources:
+  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Net-MAC
+  homepage: https://github.com/ollyg/Net-MAC/wiki
+  repository: git://github.com/ollyg/Net-MAC.git
+version: 2.103622

Modified: trunk/libnet-mac-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/Makefile.PL?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/Makefile.PL (original)
+++ trunk/libnet-mac-perl/Makefile.PL Fri Dec 31 13:54:16 2010
@@ -1,12 +1,55 @@
-use inc::Module::Install 0.67;
-perl_version '5.008001';
-  
-name        'Net-MAC';
-all_from    'lib/Net/MAC.pm';
 
-test_requires  'Test::More' => 0;
-test_requires  'Test::Pod' => 0;
-test_requires  'Test::Pod::Coverage' => 0;
+use strict;
+use warnings;
 
-WriteAll;
+BEGIN { require 5.006000; }
 
+use ExtUtils::MakeMaker 6.31;
+
+
+
+my %WriteMakefileArgs = (
+  'ABSTRACT' => 'Perl extension for representing and manipulating MAC addresses ',
+  'AUTHOR' => 'Karl Ward <karlward at cpan.org>',
+  'BUILD_REQUIRES' => {
+    'Test::More' => '0'
+  },
+  'CONFIGURE_REQUIRES' => {
+    'ExtUtils::MakeMaker' => '6.31'
+  },
+  'DISTNAME' => 'Net-MAC',
+  'EXE_FILES' => [],
+  'LICENSE' => 'gpl',
+  'NAME' => 'Net::MAC',
+  'PREREQ_PM' => {
+    'Carp' => '0',
+    'integer' => '0',
+    'overload' => '0'
+  },
+  'VERSION' => '2.103622',
+  'test' => {
+    'TESTS' => 't/*.t'
+  }
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+  my $pp = $WriteMakefileArgs{PREREQ_PM};
+  for my $mod ( keys %$br ) {
+    if ( exists $pp->{$mod} ) {
+      $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+    }
+    else {
+      $pp->{$mod} = $br->{$mod};
+    }
+  }
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+

Modified: trunk/libnet-mac-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/README?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/README (original)
+++ trunk/libnet-mac-perl/README Fri Dec 31 13:54:16 2010
@@ -1,6 +1,9 @@
 NAME
     Net::MAC - Perl extension for representing and manipulating MAC
     addresses
+
+VERSION
+    version 2.103622
 
 SYNOPSIS
       use Net::MAC;
@@ -23,7 +26,7 @@
       elsif ($base == 10) { 
           print "$mac is in decimal format\n"; 
       }
-      else { die "This MAC is neither base 10 nor base 16"; } 
+      else { die "This MAC is neither base 10 nor base 16"; }
 
 DESCRIPTION
     This is a module that allows you to
@@ -63,6 +66,9 @@
       zero_padded   whether bit groups have leading zero characters
                     (Net::MAC only allows zero-padding for bit groups of 8 bits)
                     possible values: 0 1 
+      format        the name of a MAC address format specification which takes
+                    the place of the base,delimiter,bit_group and zero_padded
+                    options above
       verbose       write informational messages (useful for debugging)
                     possible values: 0 1
       die           die() on invalid MAC address (default is to die on invalid MAC) 
@@ -75,17 +81,48 @@
     object to croak(), you can give the new() method a die argument, such
     as:
 
-      my $m_obj = Net::MAC->new('mac' => '000adf012345', 'die' => 0); 
+      my $m_obj = Net::MAC->new('mac' => '000adf012345', 'die' => 0);
 
     There are cases where the auto-discovery will not be able to guess the
     numeric base of a MAC. If this happens, try giving the new() method a
     hint, like so:
 
       # Example: this MAC is actually in decimal-dotted notation, not hex
-      my $mac = Net::MAC->new('mac' => '10.0.0.12.14.8', 'base' => 10); 
+      my $mac = Net::MAC->new('mac' => '10.0.0.12.14.8', 'base' => 10);
 
     This is necessary for cases like the one above, where the class has no
     way of knowing that an address is decimal instead of hexadecimal.
+
+    If you have installed a custom MAC address format into the class (see
+    below) then you can also pass the "format" option as a hint:
+
+      my $mac = Net::MAC->new('mac' => 'ab01~ab01~ab01', 'format' => 'My_Format');
+
+  class methods
+   set_format_for()
+    When discovering MAC address formats, and converting between different
+    formats (using "convert" or "as_*") the module can use predefined common
+    formats or you can install your own for local circumstances.
+
+    For example consider a fictional device which uses MAC addresses
+    formatted like "ab01~ab01~ab01", which would otherwise not be
+    understood. You can install a new Format for this address style:
+
+      Net::MAC->set_format_for( 'My_Format_Name' => {
+          base => 16,
+          bit_group => 16,
+          delimiter => '~',
+      });
+
+    Now when using either the "format" option to "new()", or the "convert()"
+    or "as_*" methods, the module will recognise this new format
+    "My_Format_Name". The Hashref supplied can include any of the standard
+    options for formats as listed elsewhere in this documentation.
+
+      my $mac = Net::MAC->new('mac' => 'ab01~ab01~ab01', 'format' => 'My_Format_Name');
+
+    Custom formats sharing the same name as one shipping with the module
+    (such as "Cisco") will override that built-in format.
 
   accessor methods
    get_mac() method
@@ -130,7 +167,7 @@
 
       00.80.02.ac.4f.ff     # get_zero_padded() returns 1
       0:80:2:ac:4f:ff       # get zero_padded() returns 0
-      0.125.85.122.155.64   # get_zero_padded() returns 0 
+      0.125.85.122.155.64   # get_zero_padded() returns 0
 
     Net::MAC only allows bit groups of 8 bits to be zero-padded.
 
@@ -213,7 +250,7 @@
       my $d = Net::MAC->new(mac => '0.8.1.9.16.16', base => 10); 
       my $h = Net::MAC->new(mac => '00:08:01:0A:10:10', base => 16); 
       if ($d == $h) { print "$d and $h are numerically equal"; } 
-      if ($d ne $h) { print " but $d and $h are not the same string"; } 
+      if ($d ne $h) { print " but $d and $h are not the same string"; }
 
 BUGS
   Malformed MAC addresses
@@ -235,29 +272,19 @@
 SEE ALSO
     Net::MacMap Net::MAC::Vendor
 
+MAINTAINER
+    Oliver Gorwits <oliver at cpan.org>
+
+CONTRIBUTORS
+    Oliver Gorwits, Robin Crook, Kevin Brintnall
+
 AUTHOR
     Karl Ward <karlward at cpan.org>
 
-MAINTAINER
-    Oliver Gorwits <oliver.gorwits at oucs.ox.ac.uk>
-
-CONTRIBUTORS
-    Oliver Gorwits, Robin Crook, Kevin Brintnall
-
 COPYRIGHT AND LICENSE
-    Copyright (C) 2005-2008 Karl Ward <karlward at cpan.org>
-
-    This program is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    This program is distributed in the hope that it will be useful, but
-    WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-    Public License for more details.
-
-    You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
+    This software is Copyright (c) 2010 by Karl Ward <karlward at cpan.org>.
+
+    This is free software, licensed under:
+
+      The GNU General Public License, Version 2, June 1991
+

Modified: trunk/libnet-mac-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/debian/changelog?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/debian/changelog (original)
+++ trunk/libnet-mac-perl/debian/changelog Fri Dec 31 13:54:16 2010
@@ -1,4 +1,4 @@
-libnet-mac-perl (1.6-1) UNRELEASED; urgency=low
+libnet-mac-perl (2.103622-1) UNRELEASED; urgency=low
 
   [ gregor herrmann ]
   * debian/control: Added: ${misc:Depends} to Depends: field.
@@ -15,8 +15,9 @@
 
   [ Nicholas Bamber ]
   * Add myself to Uploaders 
+  * New upstream release
 
- -- Ansgar Burchardt <ansgar at 43-1.org>  Thu, 03 Jun 2010 18:21:10 +0900
+ -- Nicholas Bamber <nicholas at periapt.co.uk>  Fri, 31 Dec 2010 13:55:23 +0000
 
 libnet-mac-perl (1.5-1) unstable; urgency=low
 

Modified: trunk/libnet-mac-perl/lib/Net/MAC.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/lib/Net/MAC.pm?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/lib/Net/MAC.pm (original)
+++ trunk/libnet-mac-perl/lib/Net/MAC.pm Fri Dec 31 13:54:16 2010
@@ -16,6 +16,9 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 package Net::MAC;
+BEGIN {
+  $Net::MAC::VERSION = '2.103622';
+}
 
 use 5.006000;
 use strict;
@@ -27,12 +30,6 @@
     '!=' => \&_compare_value_ne,
     'eq' => \&_compare_string,
     'ne' => \&_compare_string_ne;
-
-# RCS ident string
-#my $rcs_id = '$Id: MAC.pm 283 2008-11-08 17:47:16Z oliver $';
-
-our $VERSION = '1.5';
-$VERSION = eval $VERSION; # numify for warning-free dev releases
 
 our $AUTOLOAD;
 
@@ -69,6 +66,38 @@
         '_verbose'      => 0
     );
 
+    # new formats supplied by the user are stored here
+    my %_user_format_for = ();
+
+    # Preset formats we will accept for use by ->convert, via ->as_foo
+    my %_format_for = (
+        Cisco => {
+            base => 16,
+            bit_group => 16,
+            delimiter => '.',
+        },
+        IEEE  => {
+            base        => 16,
+            bit_group   => 8,
+            delimiter   => ':',
+            zero_padded => 1,
+            case        => 'upper',
+        },
+        Microsoft => {
+            base => 16,
+            bit_group => 8,
+            delimiter => '-',
+            case => 'upper',
+        },
+        Sun => {
+            base        => 16,
+            bit_group   => 8,
+            delimiter   => ':',
+            zero_padded => 0,
+            case        => 'lower'
+        }
+    );
+
     #
     # CLASS METHODS
     #
@@ -101,6 +130,22 @@
 
         # Set the '_die' attribute to default at the first
         $self->_default('die');
+
+        # passed a "format" as shorthand for the specific vars
+        if (exists $arg{'format'}) {
+            my $f;
+
+            $f = $_format_for{$arg{'format'}}
+                if exists $_format_for{$arg{'format'}};
+            $f = $_user_format_for{$arg{'format'}}
+                if exists $_user_format_for{$arg{'format'}};
+
+            %arg = (%arg, %$f)
+                if (defined $f and ref $f eq 'HASH');
+
+            delete $arg{'format'};
+        }
+
         foreach my $key ( keys %_attrs ) {
             $key =~ s/^_+//;
             if ( ( defined $arg{$key} ) && ( $self->_accessible("_$key") ) ) {
@@ -129,37 +174,39 @@
         }
     }
 
-    # Preset formats we will accept for use by ->convert, via ->as_foo
-    my %_format_for = (
-        Cisco => { base => 16, bit_group => 16, delimiter => '.' },
-        IEEE  => {
-            base        => 16,
-            bit_group   => 8,
-            delimiter   => ':',
-            zero_padded => 1,
-            case        => 'upper'
-        },
-        Microsoft =>
-            { base => 16, bit_group => 8, delimiter => '-', case => 'upper' },
-        Sun => {
-            base        => 16,
-            bit_group   => 8,
-            delimiter   => ':',
-            zero_padded => 0,
-            case        => 'lower'
-        }
-    );
-
     sub _format {
         my ( $self, $identifier ) = @_;
-        my $format = $_format_for{$identifier};
-        if ( ( defined $format ) && (%$format) ) {
-            return (%$format);
-        }
-        else { return (undef); }
+
+        # built-ins first
+        if (exists $_format_for{$identifier}
+            and ref $_format_for{$identifier} eq 'HASH') {
+            return %{$_format_for{$identifier}};
+        }
+
+        # then user-supplied
+        if (exists $_user_format_for{$identifier}
+            and ref $_user_format_for{$identifier} eq 'HASH') {
+            return %{$_user_format_for{$identifier}};
+        }
+
+        return (undef);
+    }
+
+    # program in a new custom MAC address format supplied by the user
+    sub _set_format_for {
+        my ($self, $identifier, $format) = @_;
+        croak "missing identifier for custom format\n"
+            unless defined $identifier and length $identifier;
+        croak "missing HASH ref custom format\n"
+            unless defined $format and ref $format eq 'HASH';
+
+        $_user_format_for{$identifier} = $format;
     }
 
 }    # End closure
+
+# program in a new custom MAC address format supplied by the user
+sub set_format_for { goto &_set_format_for }
 
 # Automatic accessor methods via AUTOLOAD
 # See Object Oriented Perl, 3.3, Damian Conway
@@ -213,7 +260,8 @@
             "discovery of MAC address metadata failed, no meaningful characters in $mac"
         );
     }
-    elsif ( $mac =~ /[^:\.\-\sa-fA-F0-9]/ ) {
+    # XXX: this isn't a very effective check for anything
+    elsif ( $mac =~ /[g-z]/i ) {
         $self->error(
             "discovery of MAC address metadata failed, invalid characters in MAC address \"$mac\""
         );
@@ -232,7 +280,8 @@
 sub _find_delimiter {
     my ($self) = @_;
     my $mac = $self->get_mac();
-    if ( $mac =~ /(:|\.|\-|\s)/g ) {    # Found a delimiter
+    # XXX: why not just look for any non hexadec char?
+    if ( $mac =~ m/([^a-zA-Z0-9]+)/ ) {    # Found a delimiter
         $self->set_delimiter($1);
         $self->verbose("setting attribute \"delimiter\" to \"$1\"");
         return (1);
@@ -250,13 +299,13 @@
 sub _find_base {
     my ($self) = @_;
     my $mac = $self->get_mac();
+    # XXX this will fail for 00:00:00:00:00:00 ??
     if ( $mac =~ /[a-fA-F]/ ) {
-
         # It's hexadecimal
         $self->set_base(16);
         return (1);
     }
-    my @groups = split( /:|\.|\-|\s/, $mac );
+    my @groups = split( /[^a-zA-Z0-9]+/, $mac );
     my $is_decimal = 0;
     foreach my $group (@groups) {
         if ( length($group) == 3 ) {
@@ -283,10 +332,8 @@
 sub _find_bit_group {
     my ($self) = @_;
     my $mac = $self->get_mac();
-    if ( $mac =~ /(:|\.|\-|\s)/g ) {    # Found a delimiter
-        my $delimiter = $1;
-        $delimiter =~ s/(\.|\-|\:)/\\$1/;
-        if ( $delimiter eq ' ' ) { $delimiter = '\s'; }
+    if ( $mac =~ m/([^a-zA-Z0-9]+)/ ) {    # Found a delimiter
+        my $delimiter = ($1 eq ' ' ? '\s' : '\\'. $1);
         my @groups = split( /$delimiter/, $mac );
         if ( ( @groups > 3 ) && ( @groups % 2 ) ) {
             $self->error("invalid MAC address format: $mac");
@@ -336,7 +383,7 @@
     }
     my $delimiter = $self->get_delimiter();
     if ( $delimiter eq ' ' ) { $delimiter = '\s'; }
-    my @groups = split( /$delimiter/, $self->get_mac() );
+    my @groups = split( /\Q$delimiter\E/, $self->get_mac() );
     foreach my $group (@groups) {
         if ( $group =~ /^0./ ) {
             $self->set_zero_padded(1);
@@ -358,8 +405,7 @@
     my @groups;
     my $delimiter = $self->get_delimiter();
     if ($delimiter) {
-        $delimiter =~ s/(\.|\-|\:)/\\$1/;
-        if ( $delimiter eq ' ' ) { $delimiter = '\s'; }
+        $delimiter = ($delimiter eq ' ' ? '\s' : '\\'. $delimiter);
         @groups = split( /$delimiter/, $mac );
     }
     else { @groups = $mac; }
@@ -450,7 +496,7 @@
         @groups = @dec_groups;
     }
     my $mac_string;
-    if ( ( exists $arg{delimiter} ) && ( $arg{delimiter} =~ /:|\-|\.|\s/ ) ) {
+    if ( exists $arg{delimiter} ) {
 
         #warn "\nconvert delimiter $arg{'delimiter'}\n";
         #my $delimiter = $arg{'delimiter'};
@@ -559,11 +605,19 @@
 
 1;                                     # Necessary for usage statement
 
+# ABSTRACT: Perl extension for representing and manipulating MAC addresses 
+
+
 __END__
+=pod
 
 =head1 NAME
 
 Net::MAC - Perl extension for representing and manipulating MAC addresses 
+
+=head1 VERSION
+
+version 2.103622
 
 =head1 SYNOPSIS
 
@@ -630,6 +684,9 @@
   zero_padded   whether bit groups have leading zero characters
                 (Net::MAC only allows zero-padding for bit groups of 8 bits)
                 possible values: 0 1 
+  format        the name of a MAC address format specification which takes
+                the place of the base,delimiter,bit_group and zero_padded
+                options above
   verbose       write informational messages (useful for debugging)
                 possible values: 0 1
   die           die() on invalid MAC address (default is to die on invalid MAC) 
@@ -652,6 +709,39 @@
 
 This is necessary for cases like the one above, where the class has no way 
 of knowing that an address is decimal instead of hexadecimal.  
+
+If you have installed a custom MAC address format into the class (see below)
+then you can also pass the C<format> option as a hint:
+
+  my $mac = Net::MAC->new('mac' => 'ab01~ab01~ab01', 'format' => 'My_Format');
+
+=head2 class methods
+
+=head3 set_format_for()
+
+When discovering MAC address formats, and converting between different
+formats (using C<convert> or C<as_*>) the module can use predefined common
+formats or you can install your own for local circumstances.
+
+For example consider a fictional device which uses MAC addresses formatted
+like C<ab01~ab01~ab01>, which would otherwise not be understood. You can
+install a new Format for this address style:
+
+  Net::MAC->set_format_for( 'My_Format_Name' => {
+      base => 16,
+      bit_group => 16,
+      delimiter => '~',
+  });
+
+Now when using either the C<format> option to C<new()>, or the C<convert()> or
+C<as_*> methods, the module will recognise this new format C<My_Format_Name>.
+The Hashref supplied can include any of the standard options for formats as
+listed elsewhere in this documentation.
+
+  my $mac = Net::MAC->new('mac' => 'ab01~ab01~ab01', 'format' => 'My_Format_Name');
+
+Custom formats sharing the same name as one shipping with the module (such as
+C<Cisco>) will override that built-in format.
 
 =head2 accessor methods
 
@@ -816,34 +906,25 @@
 Net::MacMap
 Net::MAC::Vendor
 
+=head1 MAINTAINER
+
+Oliver Gorwits <oliver at cpan.org>
+
+=head1 CONTRIBUTORS 
+
+Oliver Gorwits, Robin Crook, Kevin Brintnall
+
 =head1 AUTHOR
 
-Karl Ward E<lt>karlward at cpan.orgE<gt>
-
-=head1 MAINTAINER
-
-Oliver Gorwits E<lt>oliver.gorwits at oucs.ox.ac.ukE<gt>
-
-=head1 CONTRIBUTORS 
-
-Oliver Gorwits, Robin Crook, Kevin Brintnall
+Karl Ward <karlward at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2005-2008 Karl Ward E<lt>karlward at cpan.orgE<gt>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+This software is Copyright (c) 2010 by Karl Ward <karlward at cpan.org>.
+
+This is free software, licensed under:
+
+  The GNU General Public License, Version 2, June 1991
 
 =cut
+

Modified: trunk/libnet-mac-perl/t/10_convert_args.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/t/10_convert_args.t?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/t/10_convert_args.t (original)
+++ trunk/libnet-mac-perl/t/10_convert_args.t Fri Dec 31 13:54:16 2010
@@ -1,4 +1,4 @@
-# $Id: 10_convert_args.t 250 2008-11-06 20:58:23Z oliver $
+# $Id$
 
 use Test::More tests => 5;
 #use Test::More qw(no_plan);

Modified: trunk/libnet-mac-perl/t/Net-MAC.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/t/Net-MAC.t?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/t/Net-MAC.t (original)
+++ trunk/libnet-mac-perl/t/Net-MAC.t Fri Dec 31 13:54:16 2010
@@ -1,4 +1,4 @@
-# $Id: Net-MAC.t 250 2008-11-06 20:58:23Z oliver $
+# $Id$
 
 # Before `make install' is performed this script should be runnable with
 # `make test'. After `make install' it should work as `perl Net-MAC.t'

Modified: trunk/libnet-mac-perl/t/bulk10.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/t/bulk10.t?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/t/bulk10.t (original)
+++ trunk/libnet-mac-perl/t/bulk10.t Fri Dec 31 13:54:16 2010
@@ -1,4 +1,4 @@
-# $Id: bulk10.t 250 2008-11-06 20:58:23Z oliver $
+# $Id$
 
 # This is a Test::More test script for Net::MAC.  This script should be 
 # runnable with `make test'.

Modified: trunk/libnet-mac-perl/t/bulk16.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-mac-perl/t/bulk16.t?rev=66713&op=diff
==============================================================================
--- trunk/libnet-mac-perl/t/bulk16.t (original)
+++ trunk/libnet-mac-perl/t/bulk16.t Fri Dec 31 13:54:16 2010
@@ -1,4 +1,4 @@
-# $Id: bulk16.t 250 2008-11-06 20:58:23Z oliver $
+# $Id$
 
 # This is a Test::More test script for Net::MAC.  This script should be 
 # runnable with `make test'.




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