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);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.