File Coverage

blib/lib/Apache/SessionX/Manager.pm
Criterion Covered Total %
statement 12 43 27.9
branch 0 8 0.0
condition 0 5 0.0
subroutine 4 10 40.0
pod 0 6 0.0
total 16 72 22.2


line stmt bran cond sub pod time code
1             ###################################################################################
2             #
3             # Apache::SessionX - Copyright (c) 1999-2001 Gerald Richter / ecos gmbh
4             # Copyright(c) 1998, 1999 Jeffrey William Baker (jeffrey@kathyandjeffrey.net)
5             #
6             # You may distribute under the terms of either the GNU General Public
7             # License or the Artistic License, as specified in the Perl README file.
8             #
9             # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10             # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11             # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12             #
13             # $Id: Manager.pm,v 1.1 2002/03/12 08:50:32 richter Exp $
14             #
15             ###################################################################################
16              
17              
18             package Apache::SessionX::Manager ;
19              
20 1     1   880 use strict;
  1         2  
  1         49  
21 1     1   6 use vars qw(@ISA $VERSION);
  1         1  
  1         80  
22              
23             $VERSION = '2.00b5';
24              
25 1     1   6 use Apache::Session;
  1         10  
  1         19  
26 1     1   6 use Apache::SessionX::Config ;
  1         2  
  1         412  
27              
28             sub new
29             {
30 0     0 0   my $class = shift;
31            
32 0   0       my $args = shift || {};
33              
34 0 0         if(ref $args ne "HASH")
35             {
36 0           die "Additional arguments should be in the form of a hash reference";
37             }
38              
39 0   0       my $config = $args -> {config} || $Apache::SessionX::Config::default;
40 0           foreach my $cfg (keys (%{$Apache::SessionX::Config::param{$config}}))
  0            
41             {
42 0 0         $args -> {$cfg} = $Apache::SessionX::Config::param{$config} -> {$cfg} if (!exists $args -> {$cfg}) ;
43             }
44            
45 0           my $self =
46             {
47             args => $args,
48             };
49            
50 0           bless $self, $class;
51              
52 0           Apache::SessionX -> require_modules ($args) ;
53 0           Apache::SessionX::populate ($self) ;
54              
55              
56 0           return $self ;
57             }
58              
59              
60             sub count_sessions
61             {
62 0     0 0   my $self = shift;
63 0           return $self->{object_store}->count_sessions($self);
64             }
65            
66             sub first_session_id
67             {
68 0     0 0   my $self = shift;
69 0           return $self->{object_store}->first_session_id($self);
70             }
71            
72             sub next_session_id
73             {
74 0     0 0   my $self = shift;
75 0           return $self->{object_store}->next_session_id($self);
76             }
77            
78             sub first_session
79             {
80 0     0 0   my $self = shift;
81 0           my %session ;
82 0           my $id = $self -> first_session_id ;
83              
84 0 0         return undef if (!$id) ;
85              
86 0           tie %session, 'Apache::SessionX', $id, $self -> {args} ;
87            
88 0           return \%session ;
89             }
90            
91             sub next_session
92             {
93 0     0 0   my $self = shift;
94 0           my $id = $self -> next_session_id ;
95 0           my %session ;
96              
97 0 0         return undef if (!$id) ;
98              
99 0           tie %session, 'Apache::SessionX', $id, $self -> {args} ;
100            
101 0           return \%session ;
102             }
103