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

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


Comment on Re^5: Question on design for FastCGI
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-09-30 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (372 votes), past polls