| 1 | ############################################################################# | ||
| 2 | # | ||
| 3 | # Apache::Session::Sybase | ||
| 4 | # Apache persistent user sessions in a Sybase database | ||
| 5 | # Copyright(c) 1998, 1999, 2000 Jeffrey William Baker (jwbaker@acm.org) | ||
| 6 | # Modified from Apache::Session::MySQL by Chris Winters (chris@cwinters.com) | ||
| 7 | # Distribute under the Perl License | ||
| 8 | # | ||
| 9 | ############################################################################ | ||
| 10 | |||
| 11 | package Apache::Session::Sybase; | ||
| 12 | |||
| 13 | use strict; | ||
| 14 | use vars qw( @ISA $VERSION ); | ||
| 15 | |||
| 16 | use Apache::Session; | ||
| 17 | use Apache::Session::Lock::Null; | ||
| 18 | use Apache::Session::Store::Sybase; | ||
| 19 | use Apache::Session::Generate::MD5; | ||
| 20 | use Apache::Session::Serialize::Sybase; | ||
| 21 | |||
| 22 | $VERSION = '1.00'; | ||
| 23 | @ISA = qw( Apache::Session ); | ||
| 24 | |||
| 25 | sub populate { | ||
| 26 | my $self = shift; | ||
| 27 | |||
| 28 | $self->{object_store} = new Apache::Session::Store::Sybase $self; | ||
| 29 | $self->{lock_manager} = new Apache::Session::Lock::Null $self; | ||
| 30 | $self->{generate} = \&Apache::Session::Generate::MD5::generate; | ||
| 31 | $self->{validate} = \&Apache::Session::Generate::MD5::validate; | ||
| 32 | $self->{serialize} = \&Apache::Session::Serialize::Sybase::serialize; | ||
| 33 | $self->{unserialize} = \&Apache::Session::Serialize::Sybase::unserialize; | ||
| 34 | |||
| 35 | return $self; | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; | ||
| 39 | |||
| 40 | =pod | ||
| 41 | |||
| 42 | =head1 NAME | ||
| 43 | |||
| 44 | Apache::Session::Sybase - An implementation of Apache::Session | ||
| 45 | |||
| 46 | =head1 SYNOPSIS | ||
| 47 | |||
| 48 | use Apache::Session::Sybase; | ||
| 49 | |||
| 50 | # if you want Apache::Session to open new DB handles: | ||
| 51 | |||
| 52 | tie %hash, 'Apache::Session::Sybase', $id, { | ||
| 53 | DataSource => 'dbi:Sybase:database=sessions;server=SYBASE', | ||
| 54 | UserName => $db_user, | ||
| 55 | Password => $db_pass, | ||
| 56 | Commit => 1, | ||
| 57 | }; | ||
| 58 | |||
| 59 | # or, if your handle is already opened: | ||
| 60 | |||
| 61 | tie %hash, 'Apache::Session::Sybase', $id, { | ||
| 62 | Handle => $dbh, | ||
| 63 | Commit => 0, | ||
| 64 | }; | ||
| 65 | |||
| 66 | =head1 DESCRIPTION | ||
| 67 | |||
| 68 | This module is an implementation of Apache::Session. It uses the | ||
| 69 | Sybase backing store and the Null locking scheme. See the example, | ||
| 70 | and the documentation for Apache::Session::Store::Sybase (also for the | ||
| 71 | parameters that get passed to the backing store along with the schema | ||
| 72 | necessary to save the sessions) and Apache::Session::Lock::Null for | ||
| 73 | more details. | ||
| 74 | |||
| 75 | =head1 AUTHOR | ||
| 76 | |||
| 77 | This module was based on L<Apache::Session::MySQL> which was written | ||
| 78 | by Jeffrey William Baker <jwbaker@acm.org>; it was modified by Chris | ||
| 79 | Winters <chris@cwinters.com>. | ||
| 80 | |||
| 81 | =head1 SEE ALSO | ||
| 82 | |||
| 83 | L<Apache::Session> | ||
| 84 | |||
| 85 | =cut |