I am using HTML::Embperl in conjunction with Apache::Session to control
session information and create pages. I have started to create a module
that will trim the amount of code and keep a connection with MySQL
engine alive. Below is a section of my module.
My problem is that when I connect again with a different computer my
connect all my previous connects are changed to the last one.
So in short:
Can I assign each session a seperate "permanent" connection?
Aaron Johnson
# I pass this -> $dbh = db_connect( { database => "$udat{location}",
change => 1, } );
# for those of you who haven't used HTML::Embperl $udat{location} is
session data
sub db_connect {
my $pd = shift;
if ($pd->{change}) { &db_disconnect };
if ($pd->{change} || !$dbh) {
$dbh=DBI->connect(
"dbi:mysql:$pd->{database}", 'user', 'password', {
PrintError => 1,
RaiseError => 1,
}
) || die $DBI::errstr;
return($dbh)
}
else {
# warn "No need to change!\n";
return($dbh)
}
}