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

Storing Objects in a Session

Expand Messages
  • jonathan vanasco
    slightly OT, but i m doing this in mod_perl! server Apache/2.0.52 (Unix) mod_perl/1.99_16 Perl/v5.8.1 use use Apache::Cookie; use Apache::Request (); use
    Message 1 of 5 , Feb 1, 2005
    • 0 Attachment
      slightly OT, but i'm doing this in mod_perl!

      server
      Apache/2.0.52 (Unix)
      mod_perl/1.99_16
      Perl/v5.8.1

      use
      use Apache::Cookie;
      use Apache::Request ();
      use Apache::Session;
      use Apache::Session::File;

      is there any way to store an object into an Apache Session ?

      all attempts have been fruitless. i'd rather not rebuild the object by
      hand each time, but if needed i will.
    • David J Radunz
      ... Have you tried to freeze your object and then thaw it on retrieve? perl -MCPAN -e install Storable perldoc Storable ... This email and any files
      Message 2 of 5 , Feb 1, 2005
      • 0 Attachment
        On Tue, 2005-02-01 at 23:52 -0500, jonathan vanasco wrote:
        > slightly OT, but i'm doing this in mod_perl!
        >
        > server
        > Apache/2.0.52 (Unix)
        > mod_perl/1.99_16
        > Perl/v5.8.1
        >
        > use
        > use Apache::Cookie;
        > use Apache::Request ();
        > use Apache::Session;
        > use Apache::Session::File;
        >
        > is there any way to store an object into an Apache Session ?
        >

        Have you tried to freeze your object and then thaw it on retrieve?

        perl -MCPAN -e install Storable
        perldoc Storable

        > all attempts have been fruitless. i'd rather not rebuild the object by
        > hand each time, but if needed i will.
        >

        This email and any files transmitted with it are confidential and intended solely for the
        use of the individual or entity to whom they are addressed. Please notify the sender
        immediately by email if you have received this email by mistake and delete this email
        from your system. Please note that any views or opinions presented in this email are solely
        those of the author and do not necessarily represent those of the organisation.
        Finally, the recipient should check this email and any attachments for the presence of
        viruses. The organisation accepts no liability for any damage caused by any virus
        transmitted by this email.
      • Perrin Harkins
        ... Yes, you put any object in Apache::Session as long as it can be handled by Storable. You ll need to tell us what you tried and what didn t work about it
        Message 3 of 5 , Feb 1, 2005
        • 0 Attachment
          jonathan vanasco wrote:
          > is there any way to store an object into an Apache Session ?

          Yes, you put any object in Apache::Session as long as it can be handled
          by Storable. You'll need to tell us what you tried and what didn't work
          about it before we can help you more.

          - Perrin
        • Jonathan Vanasco
          ... I never thought of using storable. I haven t actually done much work w/cookies and perl before I thought i could just place an object in the tied session
          Message 4 of 5 , Feb 2, 2005
          • 0 Attachment
            On Feb 2, 2005, at 12:00 AM, David J Radunz wrote:
            > Have you tried to freeze your object and then thaw it on retrieve?
            >
            > perl -MCPAN -e install Storable
            > perldoc Storable

            On Feb 2, 2005, at 12:28 AM, Perrin Harkins wrote:
            > Yes, you put any object in Apache::Session as long as it can be
            > handled by Storable. You'll need to tell us what you tried and what
            > didn't work about it before we can help you more.


            I never thought of using storable.
            I haven't actually done much work w/cookies and perl before
            I thought i could just place an object in the tied session variable and
            voila!

            I'll try some session storable stuff now --

            I'm basically trying to store the UserProfile object into the session,
            so I can use the methods I've made to access data in it rather than
            accessing the data directly (ideally, so that less things break in the
            future)
          • Perrin Harkins
            ... There s no need for you to use Storable. Apache::Session does it already. Just put your objects in the session. ... You can. ... Okay, so what s not
            Message 5 of 5 , Feb 2, 2005
            • 0 Attachment
              On Wed, 2005-02-02 at 12:26 -0500, Jonathan Vanasco wrote:
              > I never thought of using storable.

              There's no need for you to use Storable. Apache::Session does it
              already. Just put your objects in the session.

              > I thought i could just place an object in the tied session variable and
              > voila!

              You can.

              > I'm basically trying to store the UserProfile object into the session,
              > so I can use the methods I've made to access data in it rather than
              > accessing the data directly (ideally, so that less things break in the
              > future)

              Okay, so what's not working about it? Show us some code and some error
              messages.

              - Perrin
            Your message has been successfully submitted and would be delivered to recipients shortly.