Hi there monks, I'm in a desperate need for your wisdom!
I'm creating a FastCGI application and I have a problem (for those of you, who are not familar with fcgi - it's a cgi environment where the interpreter is started only once and inside your code you have one while loop, which is used to accept the requests). Well, in that case I can't use the exit function in order to stop the program executing any further, because the whole interpreter will exit. The solution is simple - just use next; instead of exit;. In my case the code look like this:
LOOP: while(accept()) {
... some code...
if(wanna_exit()) {&end_request;}
}
sub end_request {local $^W = 0; next LOOP;}
this code works fine (there is a warning when we exit from the subroutine by calling next; but that's fine)
My problem is when I call &end_request from a different package instead the one LOOP was defined in. I get a fatal error saying that LOOP wasn't defined in the current package. I must rely on the labels, because in the main loop I might have more while loops. Can I make LOOP to be somehow global for all packages? Any other solutions?