I am a little rusty (switched to telecomm ... just doing some web work on
the side now), but my script "looks" okay to me. The archive and many
hours to trying different things do not seem to be helping. Has anyone
seen this before, or can you see a problem with it? TIA
System Info
===========
# uname -a
Linux localhost.localdomain 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686
i686 i386 GNU/Linux
# rpm -q mod_perl
mod_perl-1.99_05-3
# rpm -q httpd
httpd-2.0.40-8
Conf snippet
============
<Directory "/var/www/html">
# This mod_perl Output filter wraps html output in the standard template
PerlOutputFilterHandler InfoMart::TemplateOutputFilter
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/html/ztest">
PerlFixupHandler InfoMart::SessionFixupHandler
</Directory>
SessionFixupHandler.pm
======================
#!/usr/bin/perl
package InfoMart::SessionFixupHandler;
use strict vars;
use warnings;
use Apache2 ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use APR::Table ();
use Apache::Const -compile => 'OK';
use CGI::Cookie;
#use Apache::Session::Postgres;
sub handler {
my $r = shift;
my $table = $r->headers_in();
my $cookies = parse CGI::Cookie($table->get("Cookie"));
my $sessionID = ($cookies && $cookies->{'sessionID'} ?
$cookies->{'sessionID'}->value : undef);
#TODO: validate the sessionID. set $sessionID to undef if invalid
if (!defined($sessionID)) {
$r->handler('modperl');
$r->push_handlers(PerlResponseHandler => sub {set_cookie});
} else {
$r->notes->set(sessionID => "$sessionID");
# my %session;
# tie %session, Apache::Session::Postgres, $sessionID, {
# DataSource => 'dbi:Pg:dbname=sessions',
# Commit => 1
# };
#$session{"foo"}="bar";
# $r->notes->set('session' => \%session);
}
return Apache::OK;
}
sub set_cookie {
my $r = shift;
# my %session;
# tie %session, Apache::Session::Postgres, undef, {
# DataSource => 'dbi:Pg:dbname=sessions',
# Commit => 1
# };
my $sessionID = 'foo';
# my $sessionID = $session{_session_id};
my $cookie = CGI::cookie(-name=>"sessionID",
-value=>$sessionID,
-expires=>"+1h",
-path=>"/",
-domain=>"www.miabusinc.com",
);
$r->err_headers_out->add('Set-Cookie' => $cookie);
$r->headers_out->set(Location =>
"http://www.miabusinc.com/cgi-bin/cookie_check.cgi?src=".($r->uri));
$r->status(302);
$r->send_http_header;
return Apache::OK;
}
1;
Error
=====
[Sun Feb 23 21:26:07 2003] [error] [client 12.236.181.139] Can't locate
object method "push_handlers" via package "Apache::RequestRec" at
/usr/lib/perl5/site_perl/5.8.0/InfoMart/SessionFixupHandler.pm line 33.