Util.pm untested

filter: Statementstmt 0.0% 0 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 15 CC 1 SCAR 6.9
CC
1
Cov
0%
dec2hex
2.0
hex2dec
2.0
CRAP 2.0
1 package EMC::WideSky::Util;
2  
3 our @ISA = qw(Exporter);
4 our @EXPORT = qw(dec2hex hex2dec); # Symbols to be exported by default
5 our @EXPORT_OK = qw(); # Symbols to be exported on request
6 our $VERSION = 0.1;
7  
8 sub dec2hex {
9 my $dec=shift @_;
10  
11 my $out=join("",reverse unpack(H2H2, chr($dec % 256).chr(int($dec/256)) ));
12 $out=~ tr[a-z][A-Z];
13 return $out;
14 }
15  
16 sub hex2dec {
17 my $hex=shift @_;
18  
19 my @dec=unpack(C4C4, pack(H2H2,substr($hex,0,2),substr($hex,2,2)));
20 return($dec[0]*256+$dec[1]);
21 }
22