T
tim
Hello
I'm new here, so, hi!
I've been having the following problem. I have a module which I am
creating to manage sessions for my website. I have the following sub in
it:
#takes an active db handle, returns a new session object.
sub newSession {
my $dbh = @_[1];
my %session;
tie %session, 'Apache::Session::MySQL', undef,
{ Handle => $dbh,
LockHandle => $dbh};
print "Session session ref = ". \%session . "\n";
return \%session;
}
In the calling routine, I have the following code:
my $sessionref = SessionManager->newSession($dbh);
my %session = %$sessionref;
tied(%session)->delete;
The first two lines seem to work ok, but the 3rd gives this error:
Can't call method "delete" on an undefined value at ./tester line 31.
Bizarely, it seems I can access the object in other ways from the same
context, as the following lines work as expected:
print "session id = $session{_session_id}\n";
print "testing session ref = " . $sessionref . "\n";
(i.e. session id is printed)
I'd really appreciate any comments or suggestions on why the above may
be occuring.
Many thanks
Tim.
I'm new here, so, hi!
I've been having the following problem. I have a module which I am
creating to manage sessions for my website. I have the following sub in
it:
#takes an active db handle, returns a new session object.
sub newSession {
my $dbh = @_[1];
my %session;
tie %session, 'Apache::Session::MySQL', undef,
{ Handle => $dbh,
LockHandle => $dbh};
print "Session session ref = ". \%session . "\n";
return \%session;
}
In the calling routine, I have the following code:
my $sessionref = SessionManager->newSession($dbh);
my %session = %$sessionref;
tied(%session)->delete;
The first two lines seem to work ok, but the 3rd gives this error:
Can't call method "delete" on an undefined value at ./tester line 31.
Bizarely, it seems I can access the object in other ways from the same
context, as the following lines work as expected:
print "session id = $session{_session_id}\n";
print "testing session ref = " . $sessionref . "\n";
(i.e. session id is printed)
I'd really appreciate any comments or suggestions on why the above may
be occuring.
Many thanks
Tim.