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

Session->Abandon question

Expand Messages
  • D. L. Fox
    Can $Session- Abandon be called from an include file, even if $Response- TrapInclude is used? Does the user have to navigate (or be redirected) to another
    Message 1 of 7 , Sep 1, 2003
    • 0 Attachment
      Can $Session->Abandon be called from an include file, even if
      $Response->TrapInclude is used? Does the user have to navigate (or be
      redirected) to another page for it to "take effect"?

      Although I have been using Apache-ASP for some time, I am new to using the
      Session object. I started playing with it at home on my win98SE machine.
      I'm using Apache 1.3.27, Perl 5.6.1 built for MSWin32-x86-multi-thread
      (ActiveState), mod_perl is listed as 1.28 on the perl.apache.org site,
      although it shows 1.27_01-dev when viewing the output of %ENV.

      I'm not sure the specific version of Apache::ASP being used but all the
      above, including Apache-ASP, came bundled with the mod_perl 1.28 Windows
      binary currently being distributed at the perl.apache.org site.

      The problem I ran into was when using $Session->Abandon from inside an
      include file. The data I stored in the Session did not disappear. However,
      when I "hit" a regular ASP page calling $Session->Abandon, it works like a
      charm.

      I did a "workaround", although I don't know if it's a Good Thing to do, or
      the Right Thing to do.

      foreach my $skey(keys(%{$Session})) {
      $Session->{$skey} = undef;
      }


      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Josh Chamas
      ... What *should* happen with $Session- Abandon is that it is set for cleanup immediately, which occurs after the current request is processed. What this means
      Message 2 of 7 , Sep 1, 2003
      • 0 Attachment
        D. L. Fox wrote:
        > Can $Session->Abandon be called from an include file, even if
        > $Response->TrapInclude is used? Does the user have to navigate (or be
        > redirected) to another page for it to "take effect"?
        >
        > Although I have been using Apache-ASP for some time, I am new to using the
        > Session object. I started playing with it at home on my win98SE machine.
        > I'm using Apache 1.3.27, Perl 5.6.1 built for MSWin32-x86-multi-thread
        > (ActiveState), mod_perl is listed as 1.28 on the perl.apache.org site,
        > although it shows 1.27_01-dev when viewing the output of %ENV.
        >
        ...
        >
        > I did a "workaround", although I don't know if it's a Good Thing to do, or
        > the Right Thing to do.
        >
        > foreach my $skey(keys(%{$Session})) {
        > $Session->{$skey} = undef;
        > }
        >

        What *should* happen with $Session->Abandon is that it is set for
        cleanup immediately, which occurs after the current request is processed.
        What this means though is that data in $Session is not cleaned up when
        $Session->Abandon is called, but this is a good thing because the
        Session_OnEnd event has not been called yet, and it needs to have a
        chance to work on the $Session data.

        After $Session->Abandon gets called, the next web request, the user
        will get a new session because the current session-id is invalid.

        So if you really want to get rid of the $Session data immediately, what
        you are doing is fine, but an even easier way would be to just:

        %$Session = ();

        Regards,

        Josh
        ________________________________________________________________
        Josh Chamas, Founder phone:925-552-0128
        Chamas Enterprises Inc. http://www.chamas.com
        NodeWorks Link Checker http://www.nodeworks.com


        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • D. L. Fox
        ... From: Josh Chamas ... Oh, yeah. I see what you mean. I didn t stop to think about Session_OnEnd needing a chance to run. ... DOH...I
        Message 3 of 7 , Sep 3, 2003
        • 0 Attachment
          ----- Original Message -----
          From: "Josh Chamas" <josh@...>
          > What this means though is that data in $Session is not cleaned up when
          > $Session->Abandon is called, but this is a good thing because the
          > Session_OnEnd event has not been called yet, and it needs to have a
          > chance to work on the $Session data.

          Oh, yeah. I see what you mean. I didn't stop to think about Session_OnEnd
          needing a chance to run.

          > So if you really want to get rid of the $Session data immediately, what
          > you are doing is fine, but an even easier way would be to just:
          >
          > %$Session = ();

          DOH...I should have thought of that. Thanks for the response, Josh.

          I have been re-writing much of what I had anyway. I find myself doing this
          alot whenever I take on a new project. It seems when I almost complete
          working on something new, an idea about a different way of doing it comes to
          me, and I realize I could have done it a much better or easier way. So, I
          start over implementing what I've learned. But it's fun, and I love
          learning.


          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Josh Chamas
          ... In many projects, it would be advisable to build one to throw away . Usually when we are learning a new technology, we are learning how to do things the
          Message 4 of 7 , Sep 3, 2003
          • 0 Attachment
            D. L. Fox wrote:
            > ...
            > I have been re-writing much of what I had anyway. I find myself doing this
            > alot whenever I take on a new project. It seems when I almost complete
            > working on something new, an idea about a different way of doing it comes to
            > me, and I realize I could have done it a much better or easier way. So, I
            > start over implementing what I've learned. But it's fun, and I love
            > learning.
            >

            In many projects, it would be advisable to "build one to throw away".
            Usually when we are learning a new technology, we are learning how
            to do things the right way with it. Then of course the project scope
            itself as changed as one figures out what it should really do anyway.

            So we are either left with maintaining something that should be thrown away,
            or redoing it from scratch. Not a lot of folks have the patience or time
            for the latter, however good project practice it may be. "Management" all
            too often thinks a prototype is a fully implemented version ready to maintain
            and extend for the entire project life cycle when little proper engineering
            has gone into it.

            I just liked your sentiment so I wanted to wax a bit on it. I haven't
            reimplemnted something for fun for quite a while, perhaps I have gotten
            too jaded, and I found sentiment inspiring :) Don't worry, I won't
            reimplement Apache::ASP from scratch, I'll take my inspiration out
            on something else!

            Regards,

            Josh
            ________________________________________________________________
            Josh Chamas, Founder phone:925-552-0128
            Chamas Enterprises Inc. http://www.chamas.com
            NodeWorks Link Checker http://www.nodeworks.com


            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          • Ian Cass
            ... The point at which you should start worrying is when you write something & don t have a better idea afterwards :) -- Ian Cass ... To unsubscribe, e-mail:
            Message 5 of 7 , Sep 4, 2003
            • 0 Attachment
              D. L. Fox wrote:
              > I have been re-writing much of what I had anyway. I find myself
              > doing this alot whenever I take on a new project. It seems when I
              > almost complete working on something new, an idea about a different
              > way of doing it comes to me, and I realize I could have done it a
              > much better or easier way. So, I start over implementing what I've
              > learned. But it's fun, and I love learning.

              The point at which you should start worrying is when you write something &
              don't have a better idea afterwards :)

              --
              Ian Cass


              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...
            • D. L. Fox
              ... From: Josh Chamas To: D. L. Fox Cc: Sent: Thursday, September 04, 2003 1:07 AM Subject: Re:
              Message 6 of 7 , Sep 5, 2003
              • 0 Attachment
                ----- Original Message -----
                From: "Josh Chamas" <josh@...>
                To: "D. L. Fox" <dfox@...>
                Cc: <asp@...>
                Sent: Thursday, September 04, 2003 1:07 AM
                Subject: Re: Session->Abandon question

                > I haven't reimplemnted something for fun for quite a while,
                > perhaps I have gotten too jaded, and I found sentiment inspiring :)
                > Don't worry, I won't reimplement Apache::ASP from scratch, I'll
                > take my inspiration out on something else!

                whew ...::::wiping sweat::::... glad to hear that.......hehe

                Actually, I wanted to take the time to thank you, and whomever has helped,
                for developing Apache-ASP. I had programmed in Perl for some time (though I
                don't claim to be good at it :) but, since I also knew VB, I had switched to
                VB in IIS-ASP for web stuff because of its ease of use in embedding code
                with HTML (please don't beat me too severely). When I discovered
                Apache-ASP, it was like a dream come true. I would much rather code in Perl
                than any other language. Thanks for such a fine product!


                ---------------------------------------------------------------------
                To unsubscribe, e-mail: asp-unsubscribe@...
                For additional commands, e-mail: asp-help@...
              • D. L. Fox
                ... From: Ian Cass To: Sent: Thursday, September 04, 2003 4:44 AM Subject: Re: Session- Abandon question ... Point
                Message 7 of 7 , Sep 5, 2003
                • 0 Attachment
                  ----- Original Message -----
                  From: "Ian Cass" <ian.cass@...>
                  To: <asp@...>
                  Sent: Thursday, September 04, 2003 4:44 AM
                  Subject: Re: Session->Abandon question


                  > The point at which you should start worrying is when you write something &
                  > don't have a better idea afterwards :)

                  Point well taken. I hadn't thought of it that way. Now I don't feel so bad
                  about all the re-writing I do. :)


                  ---------------------------------------------------------------------
                  To unsubscribe, e-mail: asp-unsubscribe@...
                  For additional commands, e-mail: asp-help@...
                Your message has been successfully submitted and would be delivered to recipients shortly.