Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 pondering the Monastery: (10)
As of 2015-07-06 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls