AxKit-XSP-Session

 view release on metacpan or  search on metacpan

lib/Apache/AxKit/Plugins/Session.pm  view on Meta::CPAN

    );

    # Load session-type specific parameters
    foreach my $arg ( split( /\s*,\s*/, $r->dir_config( 'SessionArgs' ) ) )
    {
        my ($key, $value) = split( /\s*=>\s*/, $arg );
        $flex_options{$key} = $value;
    }

    # Read in the cookie if this is an old session
    my $cookie = $r->header_in('Cookie');
    {
        # eliminate logging of Apache::Session warn messages
        local $^W = 0;

        $cookie =~ s/SESSION_ID=(\w*)/$1/;
        if ( $cookie ) {
            print STDERR "Loading existing session: \"$cookie\"\n" if DEBUG;
            my $res = tieHash( $cookie, \%flex_options );
            print STDERR "The tie returned $res\n" if DEBUG and $res;
        }

lib/Apache/AxKit/Plugins/Session.pm  view on Meta::CPAN

            print STDERR "Creating a new session, since \"$session{_session_id}\" didn't work.\n" if DEBUG;
            my $res = tieHash( undef, \%flex_options );
            $no_cookie = 1;
        }
    }

    # Might be a new session, so lets give them a cookie
    if (!defined($cookie) || $no_cookie)
    {
        my $session_cookie = "SESSION_ID=$session{_session_id}";
        $r->header_out("Set-Cookie" => $session_cookie);
        $session{_creation_time} = time;
        print STDERR "Set a new header for the session cookie: \"$session_cookie\"\n" if DEBUG;
    }

    # Update the "Last Accessed" timestamp key
    $session{_last_accessed_time} = time;

    # This is to try using the pnotes table, passing as a ref
    $r->pnotes( xsp_session => \%session );
    $r->pnotes( xsp_session_ref => tied %session );



( run in 0.478 second using v1.01-cache-2.11-cpan-e9199f4ba4c )