Loading ...
Sorry, an error occurred while loading the content.

Re: Apache::Session and pnotes

Expand Messages
  • Perrin Harkins
    ... Okay, then what is the problem that you re asking for help with here? ... Okay, but I was asking how you get it back from pnotes. ... Sorry, I don t
    Message 1 of 7 , Sep 1, 2003
    • 0 Attachment
      On Tue, 2003-09-02 at 05:02, Xavier Noria wrote:
      > > Can you tell us more about the problem is? What do you see when you
      > > take the session hash back out of pnotes?
      >
      > I have dumped the hash in a content handler and it seems to be OK.

      Okay, then what is the problem that you're asking for help with here?

      > When a request is received the session id is retrieved from a cookie.
      > The schema (with some irrelevant checks removed) would be this:
      >
      > my %cookies = Apache::Cookie->fetch;
      > my $cookie = $cookies{COOKIE_NAME()};
      > my $session_id = $cookie->value;
      > my %session;
      > eval {
      > tie %session, 'Apache::Session::Oracle', $session_id,
      > {Handle => $class->dbh(), Commit => 1};
      > };

      Okay, but I was asking how you get it back from pnotes.

      > That code works all right if \%session is not stored in pnotes(), but if
      > it is put the session is not read back from the database and I have
      > checked from a database client that there is no new row written.

      Sorry, I don't understand what you're saying here. What you should be
      doing is fetching the session once, putting it in pnotes, and getting it
      from pnotes for the rest of the request.

      - Perrin


      --
      Reporting bugs: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
    • Xavier Noria
      ... I am sorry, I ll try to reword it. Let s assume a new user comes to the website. We set up a session for him and put the session id in a cookie to be sent
      Message 2 of 7 , Sep 2, 2003
      • 0 Attachment
        On Tuesday 02 September 2003 07:28, Perrin Harkins wrote:

        > Sorry, I don't understand what you're saying here. What you should
        > be doing is fetching the session once, putting it in pnotes, and
        > getting it from pnotes for the rest of the request.

        I am sorry, I'll try to reword it.

        Let's assume a new user comes to the website. We set up a session for
        him and put the session id in a cookie to be sent in the response. As
        you know, somewhere in the request cycle of that particular request
        Apache::Session::Oracle stores the session in the database.

        When later that very user comes back to the website with a valid session
        id in the cookie, one reads the session from the database.

        The problem I am facing is that if the session is stored in pnotes() it
        doesn't end up in the database. When the user comes back that id
        corresponds to no row in the sessions table.

        Is it better now?

        -- fxn




        --
        Reporting bugs: http://perl.apache.org/bugs/
        Mail list info: http://perl.apache.org/maillist/modperl.html
      • Enrico Sorcinelli
        On Tue, 2 Sep 2003 20:21:45 +0200 ... Hi Xavier, If you want a transaparent session management you could also look Apache::SessionManager mod_perl extension.
        Message 3 of 7 , Sep 5, 2003
        • 0 Attachment
          On Tue, 2 Sep 2003 20:21:45 +0200
          Xavier Noria <fxn@...> wrote:

          > On Tuesday 02 September 2003 07:28, Perrin Harkins wrote:
          >
          > > Sorry, I don't understand what you're saying here. What you should
          > > be doing is fetching the session once, putting it in pnotes, and
          > > getting it from pnotes for the rest of the request.
          >
          > I am sorry, I'll try to reword it.
          >
          > Let's assume a new user comes to the website. We set up a session for
          > him and put the session id in a cookie to be sent in the response. As
          > you know, somewhere in the request cycle of that particular request
          > Apache::Session::Oracle stores the session in the database.
          >
          > When later that very user comes back to the website with a valid session
          > id in the cookie, one reads the session from the database.
          >
          > The problem I am facing is that if the session is stored in pnotes() it
          > doesn't end up in the database. When the user comes back that id
          > corresponds to no row in the sessions table.
          >

          Hi Xavier,

          If you want a transaparent session management you could also look Apache::SessionManager
          mod_perl extension. No extra code to write but a few lines to add in httpd.conf or
          .htaccess.file

          :-)

          by

          - Enrico


          --
          Reporting bugs: http://perl.apache.org/bugs/
          Mail list info: http://perl.apache.org/maillist/modperl.html
        • Perrin Harkins
          Sorry, I missed this message until now... ... It happens when the session object gets destroyed. ... Okay, the problem is not pnotes. The pnotes stuff gets
          Message 4 of 7 , Sep 5, 2003
          • 0 Attachment
            Sorry, I missed this message until now...

            On Tue, 2003-09-02 at 14:21, Xavier Noria wrote:
            > Let's assume a new user comes to the website. We set up a session for
            > him and put the session id in a cookie to be sent in the response. As
            > you know, somewhere in the request cycle of that particular request
            > Apache::Session::Oracle stores the session in the database.

            It happens when the session object gets destroyed.

            > The problem I am facing is that if the session is stored in pnotes() it
            > doesn't end up in the database. When the user comes back that id
            > corresponds to no row in the sessions table.

            Okay, the problem is not pnotes. The pnotes stuff gets cleared at the
            end of every request, so it would save then, after the user
            disconnects. Probably what's happening is that you have a scoping
            problem somewhere in your code that deals with pnotes and it is keeping
            the session object from going out of scope.

            One thing you can try is explicitly saving the session, using the method
            described in the Apache::Session documentation. If that works, it means
            you just have to find your scoping problem. Maybe you can locate it by
            removing code bit by bit until the problem goes away. If you can make a
            very short script that demonstrates the problem, you can post it here
            and we'll help you find it.

            - Perrin


            --
            Reporting bugs: http://perl.apache.org/bugs/
            Mail list info: http://perl.apache.org/maillist/modperl.html
          Your message has been successfully submitted and would be delivered to recipients shortly.