Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^4: Question on design for FastCGI

by Anonymous Monk
on Oct 17, 2012 at 16:04 UTC ( #999569=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Question on design for FastCGI
in thread Question on design for FastCGI

Thanks for the clear explanation.

FastCGI is harder than I had imagined at this point. I supposed I'm too accustomed to how non-persistent code works. Now, when I try to recode parts of the site to use FastCGI, I keep running into problems. For instance, with plain CGI + sessions, after a user logs out and tries to access a logged in page, my old plain CGI code works against it, so he's prevented from being logged in.

When I try to change that bit to use FastCGI, I discovered that by accessing a previously logged-in page after having logged out, a user can become logged in again - found out that it was probably due to the session being restored or something.

I've this nagging question and hope you can help enlighten me. Suppose I've some variables that hold different values depending on who's logged in e.g. no of points in a game. Am I right to say I should not set variables like this before the FastCGI loop, but to get their values for each response within the loop? Because if - what I think is happening - I set them before the loop, their values are retained due to the persistence and so different users may see the same values - or something to that effect. How do I prevent bugs like this from happening?


Comment on Re^4: Question on design for FastCGI
Re^5: Question on design for FastCGI
by Anonymous Monk on Oct 18, 2012 at 05:18 UTC

      Many thanks for your patience and enlightenment :)

      I had gone to the "CGI to mod_perl Porting, mod_perl Coding guidelines" before, which had given me some idea about what to expect. But until I actually encountered some of the issues caused by persistence, it was difficult to comprehend the ideas espoused. But I'm getting a better hang of it now than last week. At least now when something doesn't look right, I know where to look for the bug.

      Cheers and thanks again!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999569]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-08-20 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (118 votes), past polls