blib/lib/oEdtk/Util.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 16 CC 1 SCAR 6.9
CC
1
Cov
0%
_uc_hash_keys
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package oEdtk::Util;
2  
3 use strict;
4 use warnings;
5  
6 our $VERSION = 2.1126;
7 our @ISA = qw(Exporter);
8 our @EXPORT_OK = qw(_uc_hash_keys);
9  
10 # Convert all hash keys to uppercase, useful
11 # because PostgreSQL returns column names in lowercase.
12 #
13 # XXX This function is no longer used now that we set
14 # the 'FetchHashKeyName' option to 'NAME_uc' in DBAdmin.pm.
15 sub _uc_hash_keys {
16 my $hash = shift;
17  
18 $hash->{ uc $_ } = delete $hash->{$_} for keys %$hash;
19 return $hash;
20 }
21  
22 1;
23  
24 =head1 NAME
25  
26 oEdtk::Util - small one-off utility helpers
27  
28 =head1 SYNOPSIS
29  
30 use oEdtk::Util qw(_uc_hash_keys);
31  
32 my $h = { name => 'x', len => 3 };
33 _uc_hash_keys($h); # { NAME => 'x', LEN => 3 }
34  
35 =head1 DESCRIPTION
36  
37 Holds small standalone helpers that do not belong to a larger module. The
38 current helper uppercases the keys of a column-name hash; it is kept for
39 compatibility.
40  
41 =head1 FUNCTIONS
42  
43 =head2 _uc_hash_keys
44  
45 my $hash = _uc_hash_keys($hash);
46  
47 Uppercase every key of the hash reference C<$hash> in place and return it. It
48 was used to normalise the lowercase column names returned by PostgreSQL; it is
49 no longer needed now that C<oEdtk::DBAdmin> sets the C<FetchHashKeyName>
50 option to C<NAME_uc>.
51  
52 =head1 AUTHOR
53  
54 The oEdtk team.
55  
56 =cut