at a time earlier than now, Andreas Marienborg wrote:
> I just can't seem to find any info on how to specify that Apache::Session
> should create session_id's that are shorter than 32 hex chars? could
> someone point me in the right direction??
Just write a module to sub class Apache::Session. Apache::Session::MySQL is
remarkably simple. Here it is:
package Apache::Session::MySQL;
use strict;
use vars qw(@ISA $VERSION);
$VERSION = '1.01';
@ISA = qw(Apache::Session);
use Apache::Session;
use Apache::Session::Lock::MySQL;
use Apache::Session::Store::MySQL;
use Apache::Session::Generate::MD5;
use Apache::Session::Serialize::Storable;
sub populate {
my $self = shift;
$self->{object_store} = new Apache::Session::Store::MySQL $self;
$self->{lock_manager} = new Apache::Session::Lock::MySQL $self;
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
1;
You can have any subroutine you want generate id's. Just change the two lines
where generate is set to Apache::Session::Generate::MD5::generate and validate
to Apache::Session::Generate::MD5::validate. For example:
package Apache::Session::MyOwnPackage;
use strict;
use vars qw(@ISA $VERSION);
$VERSION = '1.01';
@ISA = qw(Apache::Session);
use Apache::Session;
use Apache::Session::Lock::MySQL;
use Apache::Session::Store::MySQL;
use Apache::Session::Serialize::Storable;
sub populate {
my $self = shift;
$self->{object_store} = new Apache::Session::Store::MySQL $self;
$self->{lock_manager} = new Apache::Session::Lock::MySQL $self;
$self->{generate} = \&generate;
$self->{validate} = \&validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
sub generate
{
# some code to generate ids
}
sub validate
{
# some code to validate ids
}
1;
Of course, you'll actually need to write some code to generate and validate
ids. :)
HTH,
Aaron
>
> thanks in advance
>
> Andreas
>
>
> --
> Andreas Marienborg +47 92 28 63 82
> [EMAIL PROTECTED] www.palle.net
--
---
Caution! The beverage you are about to enjoy may be hot.