Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^5: Question on design for FastCGI

by Anonymous Monk
on Oct 18, 2012 at 05:18 UTC ( #999670=note: print w/replies, xml ) Need Help??

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

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?

yes , absolutely. Deciding whether a user is logged in (authentication), or allowed to view something (authorization), needs to happen from within the loop before you decide what kind of content (page) to return

How do I prevent bugs like this from happening?

proper scoping , read CGI to mod_perl Porting. mod_perl Coding guidelines, Lexical scoping like a fox, Variable Scoping in Perl: the basics

Replies are listed 'Best First'.
Re^6: Question on design for FastCGI
by Anonymous Monk on Oct 18, 2012 at 14:03 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999670]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2017-12-16 23:00 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (459 votes). Check out past polls.