| 1 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings FATAL => 'all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | # ABSTRACT: formatting MAC addresses with colon separated hex values | ||
| 5 | |||
| 6 | package NetObj::MacAddress::Formatter::Colons; | ||
| 7 | 1 | $NetObj::MacAddress::Formatter::Colons::VERSION = '1.0'; | |
| 8 | sub format { | ||
| 9 | 1 | ▶ | my ($mac) = @_; |
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||
| 10 | 1 | return join(':', unpack('H2' x 6, $mac->binary())); | |
| 11 | } | ||
| 12 | |||
| 13 | 1 | 1; | |
| 14 | |||
| 15 | __END__ | ||
| 16 | |||
| 17 | =pod | ||
| 18 | |||
| 19 | =encoding UTF-8 | ||
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | NetObj::MacAddress::Formatter::Colons - formatting MAC addresses with colon separated hex values | ||
| 24 | |||
| 25 | =head1 VERSION | ||
| 26 | |||
| 27 | version 1.0 | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | use NetObj::MacAddress::Formatter::Colons; | ||
| 32 | my $mac = NetObj::MacAddress->new('080020abcdef'); | ||
| 33 | $mac->to_string('colons'); # '08:00:20:ab:cd:ef' | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | Helper module to format a MAC address as a string in hex colon delimeted | ||
| 38 | format. | ||
| 39 | |||
| 40 | =head1 METHODS | ||
| 41 | |||
| 42 | =head2 format | ||
| 43 | |||
| 44 | Method to do the actual formatting. Used by C<NetObj::MacAddress>. | ||
| 45 | |||
| 46 | =head1 AUTHOR | ||
| 47 | |||
| 48 | Elmar S. Heeb <elmar@heebs.ch> | ||
| 49 | |||
| 50 | =head1 COPYRIGHT AND LICENSE | ||
| 51 | |||
| 52 | This software is Copyright (c) 2015 by Elmar S. Heeb. | ||
| 53 | |||
| 54 | This is free software, licensed under: | ||
| 55 | |||
| 56 | The GNU General Public License, Version 3, June 2007 | ||
| 57 | |||
| 58 | =cut | ||