lib/NetObj/MacAddress/Formatter/Dashes.pm

filter: Statementstmt 100% 10 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 14 / 14 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
format
1.0
CRAP 1.0
« lib/NetObj/MacAddress/Formatter/Colons.pm ↑ Summary lib/NetObj/MacAddress/Formatter/Dots.pm »
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 dash separated hex values
5  
6 package NetObj::MacAddress::Formatter::Dashes;
7 1 $NetObj::MacAddress::Formatter::Dashes::VERSION = '1.0';
8 sub format {
9 1 ▶ my ($mac) = @_;
Subroutine format: called CC=1 SCAR=0.0
Pod documented
10 1 return uc(join('-', unpack('H2' x 6, $_[0]->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::Dashes - formatting MAC addresses with dash separated hex values
24  
25 =head1 VERSION
26  
27 version 1.0
28  
29 =head1 SYNOPSIS
30  
31 use NetObj::MacAddress::Formatter::Dashes;
32 my $mac = NetObj::MacAddress->new('080020abcdef');
33 $mac->to_string('dashes'); # '08-00-20-AB-CD-EF'
34  
35 =head1 DESCRIPTION
36  
37 Helper module to format a MAC address as a string in hex dash delimited 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
« lib/NetObj/MacAddress/Formatter/Colons.pm ↑ Summary lib/NetObj/MacAddress/Formatter/Dots.pm »