OpenInteract/Session/SQLite.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 46 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::SQLite;
2  
3 # $Id: SQLite.pm,v 1.3 2002/09/08 20:52:43 lachoy Exp $
4  
5 use strict;
6 use base qw( OpenInteract::Session );
7 use Apache::Session::SQLite;
8  
9 $OpenInteract::Session::DBI::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 $dbname = $R->CONFIG->{session_info}{params}{dbname};
15 unless ( $dbname ) {
16 $R->throw({ code => 310, type => 'session',
17 system_msg => "Cannot use SQLite session storage without " .
18 "the parameter 'dbname' defined to a valid " .
19 "SQLite file" });
20 $R->scrib( 0, "No definition for SQLite file in 'session_info.params.dbname'" );
21 return undef;
22 }
23 my %session = ();
24 $R->DEBUG && $R->scrib( 1, "Trying to fetch session [$session_id] with db [$dbname]" );
25 eval { tie %session, 'Apache::Session::SQLite',
26 $session_id,
27 { DataSource => "DBI:SQLite:dbname=$dbname" } };
28 if ( $@ ) {
29 $R->throw({ code => 310,
30 type => 'session',
31 system_msg => $@,
32 extra => { session_id => $session_id } });
33 $R->scrib( 0, "Error thrown. Now clear the cookie" );
34 return undef;
35 }
36 return \%session if ( scalar keys %session );
37 return undef;
38 }
39  
40 1;
41  
42  
43 __END__