Browseable/Postgres.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 69 CC 5 SCAR 18.4
CC
5
Cov
0%
searchOn
12.0
searchOnExpr
12.0
populate
2.0
CRAP 6.3
1 package Apache::Session::Browseable::Postgres;
2  
3 use strict;
4  
5 use Apache::Session;
6 use Apache::Session::Lock::Null;
7 use Apache::Session::Browseable::Store::Postgres;
8 use Apache::Session::Generate::SHA256;
9 use Apache::Session::Serialize::JSON;
10 use Apache::Session::Browseable::DBI;
11  
12 our $VERSION = '1.3.1';
13 our @ISA = qw(Apache::Session::Browseable::DBI Apache::Session);
14  
15 sub populate {
16 my $self = shift;
17  
18 $self->{object_store} =
19 new Apache::Session::Browseable::Store::Postgres $self;
20 $self->{lock_manager} = new Apache::Session::Lock::Null $self;
21 $self->{generate} = \&Apache::Session::Generate::SHA256::generate;
22 $self->{validate} = \&Apache::Session::Generate::SHA256::validate;
23 $self->{serialize} = \&Apache::Session::Serialize::JSON::serialize;
24 $self->{unserialize} = \&Apache::Session::Serialize::JSON::unserialize;
25  
26 return $self;
27 }
28  
29 sub searchOn {
30 my $class = shift;
31 my ( $args, $selectField, $value, @fields ) = @_;
32 my $res = $class->SUPER::searchOn(@_);
33  
34 # Ensure fields case is preserved
35 foreach (@fields) {
36 if ( $_ ne lc($_) ) {
37 foreach my $s ( keys %$res ) {
38 $res->{$s}->{$_} = delete $res->{$s}->{ lc $_ }
39 if $res->{$s}->{ lc $_ };
40 }
41 }
42 }
43 return $res;
44 }
45  
46 sub searchOnExpr {
47 my $class = shift;
48 my ( $args, $selectField, $value, @fields ) = @_;
49 my $res = $class->SUPER::searchOnExpr(@_);
50  
51 # Ensure fields case is preserved
52 foreach (@fields) {
53 if ( $_ ne lc($_) ) {
54 foreach my $s ( keys %$res ) {
55 $res->{$s}->{$_} = delete $res->{$s}->{ lc $_ }
56 if $res->{$s}->{ lc $_ };
57 }
58 }
59 }
60 return $res;
61 }
62  
63 1;
64 __END__