i typed "install HTML::Template" and CPAN started the 5.8.1 upgrade. I know its not required, it just ran it. I've been running Apache:Session with no problem. I have had no problems for 1.5 years with my MySQL connects. You are right, I am not properly error checking, but really what I'm asking is why am I getting errors? It gets an error, every single time. Why is the connect statement failing, it was the only one trying at the time? DBI is connecting fine, it is even adding the row.
Point me to the correct path, I will follow. Please help...
Mark
| [reply] |
| [reply] |
I was running 5.6.1 before, I don't know if it had File::Spec.
I did have to re-install DBI and DBD::mysql. They appear to be working, I can issue queries, add rows and everything I could do before. Its just when Apache::Session tries that things blow up. I'm tempted to re-install perl????
Mark
| [reply] |
The suggestion for debug running has lead me to some wierd results. It ran fine??? I have re-built perl and all modules. I have traced it done to one problem. I'm going to include the code. I'm sure that I'm really understanding the problem, but can tell you all the symptoms.
On the line: $sth->bind_param(1,$session{snmember});
If I use a hard plug such as:
$sth->bind_param(1,"*");
Everything works fine. Otherwise I get no update to the session data and the error message of:
(in cleanup) Can't call method "prepare_cached" on unblessed reference at /usr/local/lib/perl5/site_perl/5.8.1/Apache/Session/Lock/MySQL.pm line 69 during global destruction.
(in cleanup) Can't call method "acquire_write_lock" on an undefined value at /usr/local/lib/perl5/site_perl/5.8.1/Apache/Session.pm line 569 during global destruction.
The query has even run succesfully for both the session handle and the bchoices handle ($dbs and $dbh). It will not update the session data during that crash though. I'm sure I'm missing something with my ugly code that you guys will spot right a way (and probably make me have to fix thousands of line of code I've messed up in the long run :-)
Thanks again for all the help, I have included the stripped down test code below:
Mark
P.S. To test I have been running it once with no params and then the second time cutting and pasting the session_id as provided by the Output into the session_id=. This code has worked with no problems on 5.6.1 for over a year!
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI ':standard',':html3','-no_xhtml';
use DBI;
use Apache::Session::MySQL;
my ($database,$username,$password)=("dbi:mysql:bchoices:localhost","stdadmin","0i812");
my $dbh = DBI->connect($database,$username,$password);
my $dbs = DBI->connect("dbi:mysql:session:localhost",$username,$password);
my %session;
my $sess_id = param('session_id');
tie %session, "Apache::Session::MySQL", $sess_id,
{
Handle => $dbs,
LockHandle => $dbs
};
if (param('session_id'))
{
my $sth=$dbh->prepare("SELECT COUNT(?) as snemployer FROM member");
$sth->bind_param(1,$session{snmember});
$sth->execute();
my $member=$sth->fetchrow_hashref();
$sth->finish();
print "Session Print 2:".$session{snmember}."-".$session{_session_id}."-".$session{test}."-".$member->{snemployer}."\n";
$session{test}="HI There";
}
else
{
$session{snmember}="*";
$session{test}="HI";
print "Session_ID:".$session{_session_id}."\n";
}
print "Session Print 1:".$session{snmember}."\n";
untie (%session);
| [reply] |