File Coverage

blib/lib/Apache/Voodoo/Session/File.pm
Criterion Covered Total %
statement 18 33 54.5
branch 0 4 0.0
condition 0 7 0.0
subroutine 5 6 83.3
pod 0 2 0.0
total 23 52 44.2


line stmt bran cond sub pod time code
1             package Apache::Voodoo::Session::File;
2              
3             $VERSION = "3.0200";
4              
5 2     2   1450 use strict;
  2         4  
  2         77  
6 2     2   10 use warnings;
  2         4  
  2         54  
7              
8 2     2   2001 use Apache::Session::File;
  2         38078  
  2         67  
9              
10 2     2   888 use Apache::Voodoo::Session::Instance;
  2         7  
  2         723  
11              
12             sub new {
13 1     1 0 3 my $class = shift;
14 1         2 my $conf = shift;
15              
16 1         3 my $self = {};
17              
18 1         3 bless $self,$class;
19              
20 1         9 $self->{session_dir} = $conf->{'session_dir'};
21              
22 1         10 return $self;
23             }
24              
25             sub attach {
26 0     0 0   my $self = shift;
27 0           my $id = shift;
28 0           my $dbh = shift;
29              
30 0           my %opts = @_;
31              
32 0           my %session;
33             my $obj;
34              
35 0           $opts{'Directory'} = $self->{'session_dir'};
36 0           $opts{'LockDirectory'} = $self->{'session_dir'};
37              
38             # Apache::Session probably validates this internally, making this check pointless.
39             # But why take that for granted?
40 0 0 0       if (defined($id) && $id !~ /^([0-9a-z]+)$/) {
41 0           $id = undef;
42             }
43              
44 0           eval {
45 0   0       $obj = tie(%session,'Apache::Session::File',$id, \%opts) || die "Tieing to session failed: $!";
46             };
47 0 0         if ($@) {
48 0           undef $id;
49 0   0       $obj = tie(%session,'Apache::Session::File',$id, \%opts) || die "Tieing to session failed: $!";
50             }
51              
52 0           return Apache::Voodoo::Session::Instance->new($obj,\%session);
53             }
54              
55             1;
56              
57             ################################################################################
58             # Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org).
59             # All rights reserved.
60             #
61             # You may use and distribute Apache::Voodoo under the terms described in the
62             # LICENSE file include in this package. The summary is it's a legalese version
63             # of the Artistic License :)
64             #
65             ################################################################################