Session/Postgres.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
populate
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #############################################################################
2 #
3 # Apache::Session::Postgres
4 # Apache persistent user sessions in a Postgres database
5 # Copyright(c) 1998, 1999, 2000 Jeffrey William Baker (jwbaker@acm.org)
6 # Distribute under the Perl License
7 #
8 ############################################################################
9
10 package Apache::Session::Postgres;
11
12 use strict;
13 use vars qw(@ISA $VERSION);
14
15 $VERSION = '1.01';
16 @ISA = qw(Apache::Session);
17
18 use Apache::Session;
19 use Apache::Session::Lock::Null;
20 use Apache::Session::Store::Postgres;
21 use Apache::Session::Generate::MD5;
22 use Apache::Session::Serialize::Base64;
23
24 sub populate {
25 my $self = shift;
26
27 $self->{object_store} = new Apache::Session::Store::Postgres $self;
28 $self->{lock_manager} = new Apache::Session::Lock::Null $self;
29 $self->{generate} = \&Apache::Session::Generate::MD5::generate;
30 $self->{validate} = \&Apache::Session::Generate::MD5::validate;
31 $self->{serialize} = \&Apache::Session::Serialize::Base64::serialize;
32 $self->{unserialize} = \&Apache::Session::Serialize::Base64::unserialize;
33
34 return $self;
35 }
36
37 1;
38
39
40 =pod
41
42 =head1 NAME
43
44 Apache::Session::Postgres - An implementation of Apache::Session
45
46 =head1 SYNOPSIS
47
48 use Apache::Session::Postgres;
49
50 #if you want Apache::Session to open new DB handles:
51
52 tie %hash, 'Apache::Session::Postgres', $id, {
53 DataSource => 'dbi:Pg:dbname=sessions',
54 UserName => $db_user,
55 Password => $db_pass,
56 Commit => 1
57 };
58
59 #or, if your handles are already opened:
60
61 tie %hash, 'Apache::Session::Postgres', $id, {
62 Handle => $dbh,
63 Commit => 1
64 };
65
66 =head1 DESCRIPTION
67
68 This module is an implementation of Apache::Session. It uses the Postgres
69 backing store and no locking. See the example, and the documentation for
70 Apache::Session::Store::Postgres for more details.
71
72 =head1 USAGE
73
74 The special Apache::Session argument for this module is Commit. You MUST
75 provide the Commit argument, which instructs this module to either commit
76 the transaction when it is finished, or to simply do nothing. This feature
77 is provided so that this module will not have adverse interactions with your
78 local transaction policy, nor your local database handle caching policy. The
79 argument is mandatory in order to make you think about this problem.
80
81 =head1 AUTHOR
82
83 This module was written by Jeffrey William Baker <jwbaker@acm.org>.
84
85 =head1 SEE ALSO
86
87 L<Apache::Session::File>, L<Apache::Session::Flex>,
88 L<Apache::Session::DB_File>, L<Apache::Session::Postgres>, L<Apache::Session>