OpenInteract/Session/File.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 63 CC 4 SCAR 25.1
CC
4
Cov
0%
_create_session
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.3
1 package OpenInteract::Session::File;
2  
3 # $Id: File.pm,v 1.3 2002/09/08 20:52:44 lachoy Exp $
4  
5 use strict;
6 use base qw( OpenInteract::Session );
7 use Apache::Session::File;
8  
9 $OpenInteract::Session::File::VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
10  
11 sub _create_session {
12 my ( $class, $session_id ) = @_;
13 my $R = OpenInteract::Request->instance;
14 my $CONFIG = $R->CONFIG;
15 my $session_params = $CONFIG->{session_info}{params} || {};
16 unless ( $session_params->{Directory} and
17 -d $session_params->{Directory} and
18 $session_params->{LockDirectory} and
19 -d $session_params->{LockDirectory} ) {
20 $R->throw({ code => 310, type => 'session',
21 system_msg => "Both the 'Directory' and 'LockDirectory' " .
22 "keys must be defined under the server " .
23 "config key 'session_info.params'" });
24 $R->scrib( 0, "Error thrown because directories (Dir: ",
25 "[$session_params->{Directory}]) (Lock: ",
26 "[$session_params->{LockDirectory}])" );
27 return undef;
28 }
29  
30 my %session = ();
31 $R->DEBUG && $R->scrib( 1, "Trying to fetch session [$session_id]" );
32 eval { tie %session, 'Apache::Session::File',
33 $session_id, $session_params };
34 if ( $@ ) {
35 $R->throw({ code => 310,
36 type => 'session',
37 system_msg => $@,
38 extra => { session_id => $session_id } });
39 $R->scrib( 0, "Error thrown. Now clear the cookie" );
40 return undef;
41 }
42 return \%session if ( scalar keys %session );
43 return undef;
44 }
45  
46 1;
47  
48  
49 __END__