Re: breaking out of accept loop in perl?

Jonathan Roy (roy@atlantic.net)
Thu, 22 May 1997 10:43:26 -0400

Message-Id: <3.0.1.32.19970522104326.0070be6c@mail.atlantic.net>
Date: Thu, 22 May 1997 10:43:26 -0400
To: philr@peoplelink.com,
From: Jonathan Roy <roy@atlantic.net>
Subject: Re: breaking out of accept loop in perl?
In-Reply-To: <3383C554.E9174136@peoplelink.com>


  Oh ok, I thought you wanted to totally exit the loop, ie: exit the
fastcgi process so a new one can start. :) That's what I use 'last' for. If
you just want to skip the current request and go back to waiting for the
next, 'next' is of course what you want. Sorry about the confusion.

-Jonathan

At 09:02 PM 5/21/97 -0700, G. Philip Reger wrote:
>Sorry I wasn't specific..
>
>During the course of an iteration there are conditions that need to
>result in the loop stopping and closing the connection to the client.
>
>The way I found to do this is call next. Break and last did not work.
>
>For instance:
>
>while (FCGI::accept() >= 0) {
>    if ($var ne "go") {
>        [halt execution and move on to the next request]
>        print "var is not go!";
>        next;
>    }
>
>    if ($var1 ne "go away") {
>        [halt and move on]
>        print "var is not go away!";
>        next;
>    }
>}
>
>See? This way accept will continue to service requests without
>completely exiting.
>
>Is this the right way to do it?
>
>phil
>
>Jonathan Roy wrote:
>> 
>>   I do something like this:
>> 
>> $mycount = 0;
>> 
>> while(FCGI::accept() >= 0) {
>>     $mycount++ > 300 and last;
>> }
>> 
>> FCGI::finish();
>> exit();
>
>-- 
>G. Philip Reger
>Mgr. Systems Operations
>PeopleLink, Inc. - Connect. Communicate. Simply.
>
>

--
Jonathan Roy - roy@idle.com -- Idle Communications, Inc.
Mail rhoefer@cdmag.com to advertise with the Games Domain! 
http://www.gamesdomain.com/ or http://www.gamesdomain.co.uk/