I know this has been mentioned before on the list, but I'm having a
heck of a time overriding $Session with Apache::Session. Josh advises:

"...I would use Apache::Session, which you can easily configure
to use by setting 'PerlSetVar AllowSessionState Off' and then setting
$Session to the Apache::Session object created in Script_OnStart."

http://groups.yahoo.com/group/apache-asp/message/1559

In Script_OnStart, I have:

    use vars qw(%session);
    my $id = $Request->Cookies('_session_id') || undef;
    tie %session, 'Apache::Session::MySQL', $id, \%session_connect;
    $Session = \%session;
    $Server->RegisterCleanup(sub { untie(%session); });
    $Response->Cookies('_session_id', $session{'_session_id'});

There's clearly a scoping issue there, though, because although both %
session and $Session are populated and read/writable within
Script_OnStart, they aren't from actual pages. I can fix that with
Script_OnParse:

    my $code = $Server->{ScriptRef};
    $$code = '<% $Session = \%session %>' . "\n$$code";

which seems /awfully/ clumsy. Is that really TRWTDI?

Secondly, I have an XMLSub that looks for certain information in
$Session. Previously, I could refer to $main::Session, but that
doesn't fly with the new overridden object. I don't know a way around
this one.

Any help would be appreciated. Thanks!




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to