You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Miah Gregory <Mi...@wrox.com> on 2000/06/14 20:08:41 UTC

Apache::Session error..

Hi all,
I'm getting the following errors from a piece of code..

(in cleanup) Can't call method "prepare_cached" on unblessed reference at
/usr/lib/perl5/site_perl/5.6.0/Apache/Session/Lock/MySQL.pm line 69 during
global destruction.

(in cleanup) Can't call method "release_all_locks" on an undefined value at
/usr/lib/perl5/site_perl/5.6.0/Apache/Session.pm line 576 during global
destruction.


My initialisation is as follows:

$sessionID = param("Session_ID");

# if the sessionID exists but is empty, or is '0', it's counted as a new
session

if(defined($sessionID))
{
  if ($sessionID ne "" && $sessionID ne "0")
  {
    eval { tie %session, 'Apache::Session::MySQL', $sessionID,
           {
             DataSource     => $DBDataSource,
             UserName       => $DBUserName,
             Password       => $DBPassword,
             LockDataSource => $DBDataSource,
             LockUserName   => $DBUserName,
             LockPassword   => $DBPassword
           };
         };
  }
  else { undef $sessionID; }
}

if(!(defined(%session)))
{
  tie %session, 'Apache::Session::MySQL', undef,
  {
    DataSource     => $DBDataSource,
    UserName       => $DBUserName,
    Password       => $DBPassword,
    LockDataSource => $DBDataSource,
    LockUserName   => $DBUserName,
    LockPassword   => $DBPassword
  };
  $sessionID = $session{_session_id};
}

# at this point we have:
# %session contains all the session info we may have stored
# $sessionID is the unique key for this session
#
# if %session is unset, then the session doesn't exist

if(not defined %session)
{
  # well we didn't get a session, so instead of creating a new one, flag an
error
  # -snip-
  exit;
}

It's calling this exit, because I've put in debugging calls.

That's when I get the above errors, which don't want to go away :(

Cheers,

  Miah