blib/lib/ExtUtils/Constant/Aaargh56Hash.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 43 CC 2 SCAR 9.8
CC
2
Cov
0%
from_key
6.0
to_key
2.0
STORE
2.0
CRAP 2.7
1 package ExtUtils::Constant::Aaargh56Hash;
2 # A support module (hack) to provide sane Unicode hash keys on 5.6.x perl
3 use strict;
4 require Tie::Hash;
5 use vars '@ISA';
6 @ISA = 'Tie::StdHash';
7  
8 #my $a;
9 # Storing the values as concatenated BER encoded numbers is actually going to
10 # be terser than using UTF8 :-)
11 # And the tests are slightly faster. Ops are bad, m'kay
12 sub to_key {pack "w*", unpack "U*", ($_[0] . pack "U*")};
13 sub from_key {defined $_[0] ? pack "U*", unpack 'w*', $_[0] : undef};
14  
15 sub STORE { $_[0]->{to_key($_[1])} = $_[2] }
16 sub FETCH { $_[0]->{to_key($_[1])} }
17 sub FIRSTKEY { my $a = scalar keys %{$_[0]}; from_key (each %{$_[0]}) }
18 sub NEXTKEY { from_key (each %{$_[0]}) }
19 sub EXISTS { exists $_[0]->{to_key($_[1])} }
20 sub DELETE { delete $_[0]->{to_key($_[1])} }
21  
22 #END {warn "$a accesses";}
23 1;