Here is the simplest form of the problem I can produce.

I have two handlers and want to pass some info between them visa vi pnotes.  One
is a PerlTransHandler for Apache::SessionManager and the other is a PerlHandler
for a simple Hello.pm that dumps some html with the current _session_start value
(i.e. from pnotes).  Apache::SessionManager checks to see if a session file
exists, creates one if not, and updates pnotes appropriately.

The problem - if I request index.html there is no value in pnotes for
_session_start as confirmed by Hello.pm.  It seems that there is nothing in
pnotes period.  If after the request I manually inspect the session file created
I find a value for _session_start.  Request other pages (e.g. test.html) and
there are expected pnotes entries confirmed by Hello.pm.

Apache 1.3.27 mod_perl

<httpd.conf snippet>
#START mod_perl Configuration
#----------------------------
PerlRequire conf/startup.pl
PerlSetEnv  MOD_PERL_TRACE all

PerlSetEnv  SERVER_ROOT /usr/local/apache/
#--------------------------
#END mod_perl Configuration


#START Apache::SessionManager Configuration
#------------------------------------------
PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager
#----------------------------------------
#END Apache::SessionManager Configuration


#START Block Directives
#----------------------
<Location />
    SetHandler perl-script
    PerlSetVar SessionManagerDebug 0
    PerlSetVar SessionManagerTracking On
    PerlSetVar SessionManagerExpire 3600
    PerlSetVar SessionManagerStore File
    PerlSetVar SessionManagerStoreArgs "Directory     =>
/usr/local/apache/session, \
                                        LockDirectory =>
/usr/local/apache/session/lock"
</Location>

<Directory "/usr/local/apache/htdocs">
    <Files ~ "index.html$">
        SetHandler perl-script
        PerlHandler MyApache::Hello
    </Files>

    <Files ~ "test.html$">
        SetHandler perl-script
        PerlHandler MyApache::Hello
    </Files>
</Directory>

Alias /perl/ "/usr/local/apache/perl/"

<Directory "/perl">
    AllowOverride  None
    Options        +ExecCGI
    SetHandler     perl-script
    PerlHandler    Apache::Registry
    PerlSendHeader On
</Directory>
#--------------------
#END Block Directives
</httpd.conf snippet>

<Hello.pm>
package MyApache::Hello;

use strict;
use Apache::Constants qw(:common);

sub handler {
        my $r = shift;
        $r->content_type('text/html');
        $r->send_http_header;

        my $host = $r->get_remote_host;
        my $href_session = $r->pnotes('SESSION_MANAGER_HANDLE');
        unless ($href_session) {
                print STDERR "nada\n";
        }
        my $sess_start = $href_session->{'_session_start'};
        $r->print(<<END);
<HTML>
<HEAD>
<TITLE>Hello There</TITLE>
</HEAD>
<BODY>
<H1>Hello $host</H1>
<H2>Sessoin Start: $sess_start</H2>
</BODY>
</HTML>
END

        return OK;
}
1;
</Hello.pm>


Reply via email to