Regarding the same Apache::Session issue....

I have created a program which has the form below.
If I comment out "untie %session;, the program doesn't give errors, but if I
let that line in the program, it gives an error in the browser "The server
encountered an internal error or misconfiguration and was unable to complete
your request.", however, I cannot find any error in the error log and I
don't know what could be the problem.

Can you tell me if the program has a good written form or what else might
cause that error?

Thank you.

package House::Portfolio;

use strict;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::Request ();
use Apache2::Cookie ();
use Apache2::Const -compile => qw(:common);
use Apache::Session::MySQL ();

use General::MySQL ();
use Digest::MD5 qw(md5_hex);

sub handler {
my $r = shift;

my $j = Apache2::Cookie::Jar->new($r);
my $session_id = $j->cookies('SESSION_ID');
$session_id =~ s/^SESSION_ID=// if $session_id;

my $dbh = General::MySQL::dbh(database => 'house');

my %session = ();
eval {
tie(%session, 'Apache::Session::MySQL', $session_id, {Handle => $dbh,
LockHandle => $dbh});
};

#Get the real session id:
$session_id = $session{_session_id};

my $cookie = Apache2::Cookie->new($r, -name => 'SESSION_ID', -value =>
$session_id, -path => '/', -domain => $r->hostname);
$cookie->bake($r);

my $q = Apache2::Request->new($r);
my $action = $q->param('a');

unless($session{username}) {
if ($action and $action eq 'login') {
&login($r, $q, $dbh, \%session);
}
else {
&login_form($r, $q, $dbh, \%session);
}
}
else {
#The user is logged in
#Here are called more subroutines based on some conditions...
#Some of these subroutines might add something to the session by $session
which is a reference to %session ($session->{var} = "...")
}

untie %session; #This line creates problems.

#end handler
}

#Here are defined the other subroutines which are called in the handler.

1;


Teddy

----- Original Message ----- 
From: "Jeff" <[EMAIL PROTECTED]>
Cc: <modperl@perl.apache.org>
Sent: Thursday, October 06, 2005 10:39 AM
Subject: Re: What am I missing?


> Wow! I like that - an answer, about timestamps, posted 50 minutes before
> the question arrived! Is it just a temporal anomaly? or some form of
> mod_perlish quantum tunnelling? Ain't this list fab. ;)
>
>
> -------- Original Message --------
> From: "Barksdale, Ray" <[EMAIL PROTECTED]>
> To: "Octavian Rasnita" <[EMAIL PROTECTED]>
> CC: modperl@perl.apache.org
> Subject: Re:What am I missing?
> Date: 5/10/2005 20:02
>
> >  set a timestamp in your sessions before untying.
> >
> >
> >>-----Original Message-----
> >>From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
> >>Sent: Wednesday, October 05, 2005 2:51 PM
> >>To: modperl@perl.apache.org
> >>Subject: What am I missing?
> >>
> >>Hi,
>

Reply via email to