line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
25
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
228
|
|
2
|
8
|
|
|
8
|
|
26
|
use warnings FATAL => 'all'; |
|
8
|
|
|
|
|
4
|
|
|
8
|
|
|
|
|
649
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: formatting MAC addresses in base16 hex format |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package NetObj::MacAddress::Formatter::Base16; |
7
|
|
|
|
|
|
|
$NetObj::MacAddress::Formatter::Base16::VERSION = '1.0.2'; |
8
|
|
|
|
|
|
|
sub format { |
9
|
43
|
|
|
43
|
1
|
34
|
my ($mac) = @_; |
10
|
43
|
|
|
|
|
98
|
return join('', unpack('H2' x 6, $_[0]->binary())); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__END__ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=pod |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=encoding UTF-8 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 NAME |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
NetObj::MacAddress::Formatter::Base16 - formatting MAC addresses in base16 hex format |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 VERSION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
version 1.0.2 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use NetObj::MacAddress::Formatter::Base16; # implicit for base16 format |
32
|
|
|
|
|
|
|
my $mac = NetObj::MacAddress->new('080020abcdef'); |
33
|
|
|
|
|
|
|
$mac->to_string('base16'); # '080020abcdef' |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Helper module to format a MAC address as a string in hex base16 format. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 format |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Method to do the actual formatting. Used by C<NetObj::MacAddress>. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Elmar S. Heeb <elmar@heebs.ch> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Elmar S. Heeb. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This is free software, licensed under: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |