File Coverage

blib/lib/Apache/Voodoo/Session.pm
Criterion Covered Total %
statement 12 16 75.0
branch 3 6 50.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 18 26 69.2


line stmt bran cond sub pod time code
1             ################################################################################
2             #
3             # Factory that creates either a file based or mysql based session storage object.
4             #
5             ################################################################################
6             package Apache::Voodoo::Session;
7              
8             $VERSION = "3.0200";
9              
10 2     2   13 use strict;
  2         4  
  2         93  
11 2     2   14 use warnings;
  2         2  
  2         412  
12              
13             sub new {
14 3     3 0 6 my $class = shift;
15 3         6 my $conf = shift;
16              
17 3 50       18 if (defined($conf->{'session_table'})) {
    100          
18 0 0       0 unless (defined($conf->{'database'})) {
19 0         0 die "You have sessions configured to be stored in the database but no database configuration.";
20             }
21              
22 0         0 require Apache::Voodoo::Session::MySQL;
23 0         0 return Apache::Voodoo::Session::MySQL->new($conf);
24             }
25             elsif (defined($conf->{'session_dir'})) {
26 1         898 require Apache::Voodoo::Session::File;
27 1         10 return Apache::Voodoo::Session::File->new($conf);
28             }
29             else {
30 2         31 die "You do not have a session storage mechanism defined.";
31             }
32             }
33              
34             1;
35              
36             ################################################################################
37             # Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org).
38             # All rights reserved.
39             #
40             # You may use and distribute Apache::Voodoo under the terms described in the
41             # LICENSE file include in this package. The summary is it's a legalese version
42             # of the Artistic License :)
43             #
44             ################################################################################